{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "provenance": []
    },
    "kernelspec": {
      "display_name": "Python 3",
      "name": "python3"
    }
  },
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "zkufh760uvF3"
      },
      "source": [
        "![JohnSnowLabs](https://nlp.johnsnowlabs.com/assets/images/logo.png)\n",
        "\n",
        "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/JohnSnowLabs/nlu/blob/master/examples/colab/Training/binary_text_classification/NLU_training_sentiment_classifier_demo_covid_19.ipynb)\n",
        "\n",
        "\n",
        "\n",
        "# Training a Sentiment Analysis Classifier with NLU\n",
        "## 2 Class COVID-19 Sentiment Classifer Training\n",
        "With the [SentimentDL model](https://nlp.johnsnowlabs.com/docs/en/annotators#sentimentdl-multi-class-sentiment-analysis-annotator)  from Spark NLP you can achieve State Of the Art results on any multi class text classification problem\n",
        "\n",
        "This notebook showcases the following features :\n",
        "\n",
        "- How to train the deep learning classifier\n",
        "- How to store a pipeline to disk\n",
        "- How to load the pipeline from disk (Enables NLU offline mode)\n",
        "\n",
        "\n",
        "You can achieve these results or even better on this dataset with training data:\n",
        "\n",
        "\n",
        "<br>\n",
        "\n",
        "![image.png]()\n",
        "\n",
        "\n",
        "You can achieve these results or even better on this dataset with training data:\n",
        "\n",
        "\n",
        "<br>\n",
        "\n",
        "![Screenshot 2021-02-25 190003.png]()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "dur2drhW5Rvi"
      },
      "source": [
        "# 1. Install Java 8 and NLU"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "hFGnBCHavltY"
      },
      "source": [
        "!pip install -q johnsnowlabs"
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "f4KkTfnR5Ugg"
      },
      "source": [
        "# 2. Download Coivd19 NLP Text Sentiemnt Classifcation    dataset\n",
        "https://www.kaggle.com/datatattle/covid-19-nlp-text-classification\n",
        "#Context\n",
        "\n",
        "This is a Dataset made of tweets about covid 19"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "OrVb5ZMvvrQD"
      },
      "source": [
        "! wget https://s3.amazonaws.com/auxdata.johnsnowlabs.com/public/resources/en/classifier-dl/corona_nlp/Corona_NLP_train.csv"
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 424
        },
        "id": "y4xSRWIhwT28",
        "outputId": "eaa9efdb-08ed-444f-e53d-c261efcaf812"
      },
      "source": [
        "import pandas as pd\n",
        "train_path = '/content/Corona_NLP_train.csv'\n",
        "\n",
        "train_df = pd.read_csv(train_path)\n",
        "# the text data to use for classification should be in a column named 'text'\n",
        "columns=['text','y']\n",
        "train_df = train_df[~train_df[\"y\"].isin([\"neutral\"])]\n",
        "\n",
        "train_df = train_df[columns]\n",
        "from sklearn.model_selection import train_test_split\n",
        "\n",
        "train_df, test_df = train_test_split(train_df, test_size=0.2)\n",
        "train_df"
      ],
      "execution_count": 1,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "                                                    text         y\n",
              "20175  WhatÂs the world most dangerous job?\\r\\r\\nSup...  negative\n",
              "32442  Check out how Coronavirus is transforming Cons...  positive\n",
              "4860   this was an HOUR after opened My dad was shook...  negative\n",
              "12605  ScriptCo members have their medications delive...  positive\n",
              "6444   As we continue to monitor the situation concer...  positive\n",
              "...                                                  ...       ...\n",
              "34114  Cracking Down on Retail COVID 19 Profiteers in...  positive\n",
              "36475  @SethAbramson Work. I am very fortunate to hav...  positive\n",
              "29755  Create a free Amazon Business account to save ...  positive\n",
              "39000  Best online stores to buy things from Tokyo an...  positive\n",
              "11120  Bring back the ration book to stop this Panic ...  negative\n",
              "\n",
              "[26758 rows x 2 columns]"
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-edadffbd-0072-4e86-859d-b511970fc1e7\" class=\"colab-df-container\">\n",
              "    <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>text</th>\n",
              "      <th>y</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>20175</th>\n",
              "      <td>WhatÂs the world most dangerous job?\\r\\r\\nSup...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>32442</th>\n",
              "      <td>Check out how Coronavirus is transforming Cons...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4860</th>\n",
              "      <td>this was an HOUR after opened My dad was shook...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>12605</th>\n",
              "      <td>ScriptCo members have their medications delive...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>6444</th>\n",
              "      <td>As we continue to monitor the situation concer...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>...</th>\n",
              "      <td>...</td>\n",
              "      <td>...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>34114</th>\n",
              "      <td>Cracking Down on Retail COVID 19 Profiteers in...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>36475</th>\n",
              "      <td>@SethAbramson Work. I am very fortunate to hav...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>29755</th>\n",
              "      <td>Create a free Amazon Business account to save ...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>39000</th>\n",
              "      <td>Best online stores to buy things from Tokyo an...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>11120</th>\n",
              "      <td>Bring back the ration book to stop this Panic ...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "<p>26758 rows × 2 columns</p>\n",
              "</div>\n",
              "    <div class=\"colab-df-buttons\">\n",
              "\n",
              "  <div class=\"colab-df-container\">\n",
              "    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-edadffbd-0072-4e86-859d-b511970fc1e7')\"\n",
              "            title=\"Convert this dataframe to an interactive table.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
              "    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
              "  </svg>\n",
              "    </button>\n",
              "\n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    .colab-df-buttons div {\n",
              "      margin-bottom: 4px;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "    <script>\n",
              "      const buttonEl =\n",
              "        document.querySelector('#df-edadffbd-0072-4e86-859d-b511970fc1e7 button.colab-df-convert');\n",
              "      buttonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "      async function convertToInteractive(key) {\n",
              "        const element = document.querySelector('#df-edadffbd-0072-4e86-859d-b511970fc1e7');\n",
              "        const dataTable =\n",
              "          await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                    [key], {});\n",
              "        if (!dataTable) return;\n",
              "\n",
              "        const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "          + ' to learn more about interactive tables.';\n",
              "        element.innerHTML = '';\n",
              "        dataTable['output_type'] = 'display_data';\n",
              "        await google.colab.output.renderOutput(dataTable, element);\n",
              "        const docLink = document.createElement('div');\n",
              "        docLink.innerHTML = docLinkHtml;\n",
              "        element.appendChild(docLink);\n",
              "      }\n",
              "    </script>\n",
              "  </div>\n",
              "\n",
              "\n",
              "<div id=\"df-382d2236-bced-479e-87c3-28037814d18e\">\n",
              "  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-382d2236-bced-479e-87c3-28037814d18e')\"\n",
              "            title=\"Suggest charts.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "     width=\"24px\">\n",
              "    <g>\n",
              "        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
              "    </g>\n",
              "</svg>\n",
              "  </button>\n",
              "\n",
              "<style>\n",
              "  .colab-df-quickchart {\n",
              "      --bg-color: #E8F0FE;\n",
              "      --fill-color: #1967D2;\n",
              "      --hover-bg-color: #E2EBFA;\n",
              "      --hover-fill-color: #174EA6;\n",
              "      --disabled-fill-color: #AAA;\n",
              "      --disabled-bg-color: #DDD;\n",
              "  }\n",
              "\n",
              "  [theme=dark] .colab-df-quickchart {\n",
              "      --bg-color: #3B4455;\n",
              "      --fill-color: #D2E3FC;\n",
              "      --hover-bg-color: #434B5C;\n",
              "      --hover-fill-color: #FFFFFF;\n",
              "      --disabled-bg-color: #3B4455;\n",
              "      --disabled-fill-color: #666;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart {\n",
              "    background-color: var(--bg-color);\n",
              "    border: none;\n",
              "    border-radius: 50%;\n",
              "    cursor: pointer;\n",
              "    display: none;\n",
              "    fill: var(--fill-color);\n",
              "    height: 32px;\n",
              "    padding: 0;\n",
              "    width: 32px;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart:hover {\n",
              "    background-color: var(--hover-bg-color);\n",
              "    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "    fill: var(--button-hover-fill-color);\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart-complete:disabled,\n",
              "  .colab-df-quickchart-complete:disabled:hover {\n",
              "    background-color: var(--disabled-bg-color);\n",
              "    fill: var(--disabled-fill-color);\n",
              "    box-shadow: none;\n",
              "  }\n",
              "\n",
              "  .colab-df-spinner {\n",
              "    border: 2px solid var(--fill-color);\n",
              "    border-color: transparent;\n",
              "    border-bottom-color: var(--fill-color);\n",
              "    animation:\n",
              "      spin 1s steps(1) infinite;\n",
              "  }\n",
              "\n",
              "  @keyframes spin {\n",
              "    0% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "      border-left-color: var(--fill-color);\n",
              "    }\n",
              "    20% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    30% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    40% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    60% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    80% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "    90% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "  }\n",
              "</style>\n",
              "\n",
              "  <script>\n",
              "    async function quickchart(key) {\n",
              "      const quickchartButtonEl =\n",
              "        document.querySelector('#' + key + ' button');\n",
              "      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n",
              "      quickchartButtonEl.classList.add('colab-df-spinner');\n",
              "      try {\n",
              "        const charts = await google.colab.kernel.invokeFunction(\n",
              "            'suggestCharts', [key], {});\n",
              "      } catch (error) {\n",
              "        console.error('Error during call to suggestCharts:', error);\n",
              "      }\n",
              "      quickchartButtonEl.classList.remove('colab-df-spinner');\n",
              "      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n",
              "    }\n",
              "    (() => {\n",
              "      let quickchartButtonEl =\n",
              "        document.querySelector('#df-382d2236-bced-479e-87c3-28037814d18e button');\n",
              "      quickchartButtonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "    })();\n",
              "  </script>\n",
              "</div>\n",
              "    </div>\n",
              "  </div>\n"
            ]
          },
          "metadata": {},
          "execution_count": 1
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "0296Om2C5anY"
      },
      "source": [
        "# 3. Train Deep Learning Classifier using nlu.load('train.sentiment')\n",
        "\n",
        "You dataset label column should be named 'y' and the feature column with text data should be named 'text'"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        },
        "id": "3ZIPkRkWftBG",
        "outputId": "5177ed67-1321-4eec-a83c-e035e5d28f08"
      },
      "source": [
        "from johnsnowlabs import nlp\n",
        "from sklearn.metrics import classification_report\n",
        "\n",
        "# load a trainable pipeline by specifying the train. prefix  and fit it on a datset with label and text columns\n",
        "# by default the Universal Sentence Encoder (USE) Sentence embeddings are used for generation\n",
        "trainable_pipe = nlp.load('train.sentiment')\n",
        "fitted_pipe = trainable_pipe.fit(train_df.iloc[:50])\n",
        "\n",
        "# predict with the trainable pipeline on dataset and get predictions\n",
        "preds = fitted_pipe.predict(train_df.iloc[:50],output_level='document')\n",
        "#sentence detector that is part of the pipe generates sone NaNs. lets drop them first\n",
        "preds.dropna(inplace=True)\n",
        "print(classification_report(preds['y'], preds['sentiment']))\n",
        "\n",
        "preds"
      ],
      "execution_count": 33,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Warning::Spark Session already created, some configs may not take.\n",
            "Warning::Spark Session already created, some configs may not take.\n",
            "sent_small_bert_L2_128 download started this may take some time.\n",
            "Approximate size to download 16.1 MB\n",
            "[OK!]\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "/usr/local/lib/python3.10/dist-packages/nlu/pipe/pipeline.py:149: SettingWithCopyWarning: \n",
            "A value is trying to be set on a copy of a slice from a DataFrame.\n",
            "Try using .loc[row_indexer,col_indexer] = value instead\n",
            "\n",
            "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
            "  dataset.y = dataset.y.apply(str)\n",
            "/usr/local/lib/python3.10/dist-packages/nlu/pipe/utils/data_conversion_utils.py:160: SettingWithCopyWarning: \n",
            "A value is trying to be set on a copy of a slice from a DataFrame.\n",
            "Try using .loc[row_indexer,col_indexer] = value instead\n",
            "\n",
            "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
            "  data['origin_index'] = data.index\n",
            "/usr/local/lib/python3.10/dist-packages/nlu/pipe/utils/data_conversion_utils.py:160: SettingWithCopyWarning: \n",
            "A value is trying to be set on a copy of a slice from a DataFrame.\n",
            "Try using .loc[row_indexer,col_indexer] = value instead\n",
            "\n",
            "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
            "  data['origin_index'] = data.index\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "              precision    recall  f1-score   support\n",
            "\n",
            "    negative       0.00      0.00      0.00        21\n",
            "    positive       0.58      1.00      0.73        29\n",
            "\n",
            "    accuracy                           0.58        50\n",
            "   macro avg       0.29      0.50      0.37        50\n",
            "weighted avg       0.34      0.58      0.43        50\n",
            "\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "/usr/local/lib/python3.10/dist-packages/nlu/pipe/extractors/extractor_methods/base_extractor_methods.py:356: SettingWithCopyWarning: \n",
            "A value is trying to be set on a copy of a slice from a DataFrame.\n",
            "Try using .loc[row_indexer,col_indexer] = value instead\n",
            "\n",
            "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
            "  df[cols_to_explode] = df[cols_to_explode].apply(pad_same_level_cols, axis=1)\n",
            "/usr/local/lib/python3.10/dist-packages/sklearn/metrics/_classification.py:1344: UndefinedMetricWarning: Precision and F-score are ill-defined and being set to 0.0 in labels with no predicted samples. Use `zero_division` parameter to control this behavior.\n",
            "  _warn_prf(average, modifier, msg_start, len(result))\n",
            "/usr/local/lib/python3.10/dist-packages/sklearn/metrics/_classification.py:1344: UndefinedMetricWarning: Precision and F-score are ill-defined and being set to 0.0 in labels with no predicted samples. Use `zero_division` parameter to control this behavior.\n",
            "  _warn_prf(average, modifier, msg_start, len(result))\n",
            "/usr/local/lib/python3.10/dist-packages/sklearn/metrics/_classification.py:1344: UndefinedMetricWarning: Precision and F-score are ill-defined and being set to 0.0 in labels with no predicted samples. Use `zero_division` parameter to control this behavior.\n",
            "  _warn_prf(average, modifier, msg_start, len(result))\n"
          ]
        },
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "                                             document  \\\n",
              "0   Over 45 tar sands projects that have already s...   \n",
              "1   I just got super excited because I found toile...   \n",
              "2   BE AFRAID, BE VERY AFRAIDÂINSLEE PROMOTES THE...   \n",
              "3   A lady fro @CheckersSA Brits tells me to hide ...   \n",
              "4   Just done an online shop and all the food esse...   \n",
              "5   @GavinNewsom so let me get this straight crowd...   \n",
              "6   NY: 18- to 49-year-olds make up more than half...   \n",
              "7   Emerging market debt prices reflect worst case...   \n",
              "8   do you clean your #supermarket items due to th...   \n",
              "9   @flipkartsupport @rsprasad @PMOIndia In his cr...   \n",
              "10  Several Guernsey women have set up a group of ...   \n",
              "11  I took Plaquenil for 4 years. Now it's the hot...   \n",
              "12  CanÂt let this die. A little humor in these t...   \n",
              "13  IÂve been to the grocery store three times si...   \n",
              "14  That maybe there was a rioter out there who th...   \n",
              "15  First they release and spread the virus Strip ...   \n",
              "16  For about a year I have been toying with the i...   \n",
              "17  Creation Consumer Finance in Belfast are now p...   \n",
              "18  \"Your going to lose people to the flu but you'...   \n",
              "19  If you are a #RetailWorker and your store is s...   \n",
              "20  I love this social distancing.. No one stand c...   \n",
              "21  #Facebook Ads Fails to Reject COVID-19 Misinfo...   \n",
              "22  Lease prices decline in March as as the corona...   \n",
              "23  Complete Shutdown of Karnataka W.E.F 24th Marc...   \n",
              "24  @MobilePunch Another deceitful palliative in m...   \n",
              "25  I am anyways under lockdown since 6th March be...   \n",
              "26  @KFCSA @yumbrands was at your store , the air ...   \n",
              "27  How to support and save local businesses durin...   \n",
              "28  This is the latest current information on supe...   \n",
              "29  If anyone witnesses any shops hiking their pri...   \n",
              "30  It's about time @eBay_UK stopped allowing peop...   \n",
              "31  sounds like a good idea - LA market offers spe...   \n",
              "32  No matter how they're ramping up efforts at #d...   \n",
              "33  I was wondering if a lovely supermarket would ...   \n",
              "34  Telangana people, Please dont go out unless it...   \n",
              "35  Idiots are panic purchasing food in bulk that ...   \n",
              "36  Following @BBVA_USA's initial offers last week...   \n",
              "37  Please appreciate your supermarket delivery dr...   \n",
              "38  When asked, ÂWhy does ADI continue to operate...   \n",
              "39  The long-term fallout of the #coronavirus lock...   \n",
              "40  HELP US PACK THE PANTRIES I m live at 12 15 on...   \n",
              "41  Seeing whatÂs being left behind at grocery st...   \n",
              "42  Everyone don t forget condoms when you are hoa...   \n",
              "43  If you come across any shops charging inflated...   \n",
              "44  New @SA_Update #consumer insights affecting ve...   \n",
              "45  How is COVID-19 affecting the pork and commodi...   \n",
              "46               Unbelievable https://t.co/fBrPYaxNH6   \n",
              "47  How prepared are UK supermarkets to fulfill co...   \n",
              "48  Quakertown Distiller Providing Hand Sanitizer ...   \n",
              "49  Trump's disastrous dumbfuckery about #coronavi...   \n",
              "\n",
              "                 sentence_embedding_small_bert_L2_128 sentiment  \\\n",
              "0   [-0.040878042578697205, 0.7422170639038086, -1...  positive   \n",
              "1   [-0.8823249340057373, 0.2473045289516449, -0.2...  positive   \n",
              "2   [-0.5860391855239868, 0.45967912673950195, -0....  positive   \n",
              "3   [-1.0504486560821533, 0.03315277025103569, -0....  positive   \n",
              "4   [-0.7228847742080688, 0.12011835724115372, -0....  positive   \n",
              "5   [-0.7876735329627991, -0.0005504372529685497, ...  positive   \n",
              "6   [-0.7093901634216309, 0.15827353298664093, -0....  positive   \n",
              "7   [-0.38020092248916626, 0.469475656747818, -1.0...  positive   \n",
              "8   [-0.9434630870819092, 0.15352500975131989, -0....  positive   \n",
              "9   [-0.5607839226722717, 0.01385028287768364, -0....  positive   \n",
              "10  [-0.5054810047149658, 0.3916030824184418, -0.1...  positive   \n",
              "11  [-0.7918602228164673, 0.6628591418266296, -0.4...  positive   \n",
              "12  [-0.6068148016929626, 0.4092712998390198, 0.18...  positive   \n",
              "13  [-1.2009631395339966, 0.18674977123737335, -0....  positive   \n",
              "14  [-0.9833343029022217, 0.002539500128477812, -0...  positive   \n",
              "15  [-0.903867781162262, 0.3173466622829437, -0.74...  positive   \n",
              "16  [-0.7246012091636658, 0.4053008258342743, -0.2...  positive   \n",
              "17  [-0.08034359663724899, 0.9084559082984924, -0....  positive   \n",
              "18  [-1.6253035068511963, 0.23702141642570496, -0....  positive   \n",
              "19  [-0.18891872465610504, 1.0232254266738892, -0....  positive   \n",
              "20  [-0.7862111330032349, 0.17004938423633575, -0....  positive   \n",
              "21  [0.09989737719297409, 0.21870799362659454, 0.2...  positive   \n",
              "22  [-0.21414655447006226, 0.6170880794525146, -0....  positive   \n",
              "23  [-1.0250476598739624, 0.7916482090950012, -0.4...  positive   \n",
              "24  [-0.967275083065033, 0.39687538146972656, -0.3...  positive   \n",
              "25  [-0.8778604865074158, 0.4535127580165863, -0.8...  positive   \n",
              "26  [-1.004093050956726, 0.5079272985458374, -0.48...  positive   \n",
              "27  [-0.7925586700439453, 0.2502853572368622, -0.0...  positive   \n",
              "28  [-1.155573844909668, 1.2174267768859863, -0.72...  positive   \n",
              "29  [-1.0366969108581543, 0.9876224398612976, 0.21...  positive   \n",
              "30  [-0.6213818788528442, 0.8505221009254456, -0.0...  positive   \n",
              "31  [-0.8883647918701172, 0.09247803688049316, 0.0...  positive   \n",
              "32  [-0.6616833209991455, 0.4456593692302704, -0.1...  positive   \n",
              "33  [-0.7988455891609192, 0.3940075635910034, -0.2...  positive   \n",
              "34  [-0.859315812587738, 0.18060781061649323, -0.3...  positive   \n",
              "35  [-1.1440715789794922, 0.10256315022706985, -0....  positive   \n",
              "36  [-0.4633345901966095, 0.6127039790153503, -0.0...  positive   \n",
              "37  [-0.8110732436180115, 0.9440520405769348, -0.2...  positive   \n",
              "38  [-0.7378478050231934, 1.1133265495300293, -0.6...  positive   \n",
              "39  [-0.4056348204612732, 0.8604288101196289, -0.2...  positive   \n",
              "40  [-1.0248322486877441, 0.3955387771129608, -0.5...  positive   \n",
              "41  [-0.7818620800971985, 0.35503625869750977, 0.1...  positive   \n",
              "42  [-1.7940707206726074, 0.559665322303772, -0.49...  positive   \n",
              "43  [-0.878898024559021, 0.7265058755874634, 0.008...  positive   \n",
              "44  [0.0033321159426122904, 0.9780365228652954, -0...  positive   \n",
              "45  [-0.6315991282463074, 0.5254122018814087, -0.3...  positive   \n",
              "46  [-0.4117434322834015, 0.6890383362770081, 0.51...  positive   \n",
              "47  [-0.5095536112785339, 0.48363006114959717, 0.0...  positive   \n",
              "48  [-1.3492352962493896, 0.669184684753418, -0.38...  positive   \n",
              "49  [-0.7200496792793274, 0.3299054205417633, -0.4...  positive   \n",
              "\n",
              "   sentiment_confidence                                               text  \\\n",
              "0                   4.0  Over 45 tar sands projects that have already s...   \n",
              "1                   1.0  I just got super excited because I found toile...   \n",
              "2                   3.0  BE AFRAID, BE VERY AFRAIDÂINSLEE PROMOTES THE...   \n",
              "3                   2.0  A lady fro @CheckersSA Brits tells me to hide ...   \n",
              "4                   3.0  Just done an online shop and all the food esse...   \n",
              "5                   2.0  @GavinNewsom  so let me get this straight crow...   \n",
              "6                   2.0  NY: 18- to 49-year-olds make up more than half...   \n",
              "7                   1.0  Emerging market debt prices reflect worst case...   \n",
              "8                   3.0  do you clean your #supermarket  items due to t...   \n",
              "9                   3.0  @flipkartsupport @rsprasad\\r\\r\\n@PMOIndia In h...   \n",
              "10                  5.0  Several Guernsey women have set up a group of ...   \n",
              "11                  3.0  I took Plaquenil for 4 years. Now it's the hot...   \n",
              "12                  2.0  CanÂt let this die. A little humor in these t...   \n",
              "13                  1.0  IÂve been to the grocery store three times si...   \n",
              "14                  1.0  That maybe there was a rioter out there who th...   \n",
              "15                  3.0  First they release and spread the virus Strip ...   \n",
              "16                  9.0  For about a year I have been toying with the i...   \n",
              "17                  1.0  Creation Consumer Finance in Belfast are now p...   \n",
              "18                  4.0  \"Your going to lose people to the flu but you'...   \n",
              "19                  2.0  If you are a #RetailWorker and your store is s...   \n",
              "20                  8.0  I love this social distancing..\\r\\r\\n\\r\\r\\nNo ...   \n",
              "21                  1.0  #Facebook Ads Fails to Reject COVID-19 Misinfo...   \n",
              "22                  1.0  Lease prices decline in March as as the corona...   \n",
              "23                  5.0  Complete Shutdown of Karnataka W.E.F 24th Marc...   \n",
              "24                  1.0  @MobilePunch Another deceitful palliative in m...   \n",
              "25                  4.0  I am anyways under lockdown since 6th March be...   \n",
              "26                  1.0  @KFCSA @yumbrands was at your store , the air ...   \n",
              "27                  1.0  How to support and save local businesses durin...   \n",
              "28                  7.0  This is the latest current information on supe...   \n",
              "29                  6.0  If anyone witnesses any shops hiking their pri...   \n",
              "30                  1.0  It's about time @eBay_UK stopped allowing peop...   \n",
              "31                  2.0  sounds like a good idea - LA market offers spe...   \n",
              "32                  2.0  No matter how they're ramping up efforts at #d...   \n",
              "33                  1.0  I was wondering if a lovely supermarket would ...   \n",
              "34                  1.0  Telangana people, Please dont go out unless it...   \n",
              "35                  1.0  Idiots are panic purchasing food in bulk that ...   \n",
              "36                  2.0  Following @BBVA_USA's initial offers last week...   \n",
              "37                  3.0  Please appreciate your supermarket delivery dr...   \n",
              "38                  9.0  When asked, ÂWhy does ADI continue to operate...   \n",
              "39                  2.0  The long-term fallout of the #coronavirus lock...   \n",
              "40                  4.0  HELP US PACK THE PANTRIES I m live at 12 15 on...   \n",
              "41                  4.0  Seeing whatÂs being left behind at grocery st...   \n",
              "42                  2.0  Everyone don t forget condoms when you are hoa...   \n",
              "43                  1.0  If you come across any shops charging inflated...   \n",
              "44                  6.0  New @SA_Update  #consumer insights affecting v...   \n",
              "45                  4.0  How is COVID-19 affecting the pork and commodi...   \n",
              "46                  4.0               Unbelievable https://t.co/fBrPYaxNH6   \n",
              "47                  1.0  How prepared are UK supermarkets to fulfill co...   \n",
              "48                  1.0  Quakertown Distiller Providing Hand Sanitizer ...   \n",
              "49                  1.0  Trump's disastrous dumbfuckery about #coronavi...   \n",
              "\n",
              "           y  \n",
              "0   positive  \n",
              "1   positive  \n",
              "2   positive  \n",
              "3   positive  \n",
              "4   negative  \n",
              "5   negative  \n",
              "6   negative  \n",
              "7   negative  \n",
              "8   positive  \n",
              "9   negative  \n",
              "10  negative  \n",
              "11  positive  \n",
              "12  negative  \n",
              "13  negative  \n",
              "14  positive  \n",
              "15  negative  \n",
              "16  positive  \n",
              "17  negative  \n",
              "18  negative  \n",
              "19  positive  \n",
              "20  positive  \n",
              "21  negative  \n",
              "22  positive  \n",
              "23  negative  \n",
              "24  negative  \n",
              "25  positive  \n",
              "26  negative  \n",
              "27  positive  \n",
              "28  positive  \n",
              "29  positive  \n",
              "30  negative  \n",
              "31  positive  \n",
              "32  positive  \n",
              "33  positive  \n",
              "34  positive  \n",
              "35  negative  \n",
              "36  negative  \n",
              "37  positive  \n",
              "38  positive  \n",
              "39  positive  \n",
              "40  positive  \n",
              "41  negative  \n",
              "42  positive  \n",
              "43  positive  \n",
              "44  positive  \n",
              "45  negative  \n",
              "46  positive  \n",
              "47  positive  \n",
              "48  positive  \n",
              "49  negative  "
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-1fa53f72-e1a6-4ee6-88d9-cd5576eed3ee\" class=\"colab-df-container\">\n",
              "    <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>document</th>\n",
              "      <th>sentence_embedding_small_bert_L2_128</th>\n",
              "      <th>sentiment</th>\n",
              "      <th>sentiment_confidence</th>\n",
              "      <th>text</th>\n",
              "      <th>y</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>Over 45 tar sands projects that have already s...</td>\n",
              "      <td>[-0.040878042578697205, 0.7422170639038086, -1...</td>\n",
              "      <td>positive</td>\n",
              "      <td>4.0</td>\n",
              "      <td>Over 45 tar sands projects that have already s...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>I just got super excited because I found toile...</td>\n",
              "      <td>[-0.8823249340057373, 0.2473045289516449, -0.2...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>I just got super excited because I found toile...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>BE AFRAID, BE VERY AFRAIDÂINSLEE PROMOTES THE...</td>\n",
              "      <td>[-0.5860391855239868, 0.45967912673950195, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>3.0</td>\n",
              "      <td>BE AFRAID, BE VERY AFRAIDÂINSLEE PROMOTES THE...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>A lady fro @CheckersSA Brits tells me to hide ...</td>\n",
              "      <td>[-1.0504486560821533, 0.03315277025103569, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>A lady fro @CheckersSA Brits tells me to hide ...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>Just done an online shop and all the food esse...</td>\n",
              "      <td>[-0.7228847742080688, 0.12011835724115372, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>3.0</td>\n",
              "      <td>Just done an online shop and all the food esse...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>5</th>\n",
              "      <td>@GavinNewsom so let me get this straight crowd...</td>\n",
              "      <td>[-0.7876735329627991, -0.0005504372529685497, ...</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>@GavinNewsom  so let me get this straight crow...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>6</th>\n",
              "      <td>NY: 18- to 49-year-olds make up more than half...</td>\n",
              "      <td>[-0.7093901634216309, 0.15827353298664093, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>NY: 18- to 49-year-olds make up more than half...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>7</th>\n",
              "      <td>Emerging market debt prices reflect worst case...</td>\n",
              "      <td>[-0.38020092248916626, 0.469475656747818, -1.0...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>Emerging market debt prices reflect worst case...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>8</th>\n",
              "      <td>do you clean your #supermarket items due to th...</td>\n",
              "      <td>[-0.9434630870819092, 0.15352500975131989, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>3.0</td>\n",
              "      <td>do you clean your #supermarket  items due to t...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>9</th>\n",
              "      <td>@flipkartsupport @rsprasad @PMOIndia In his cr...</td>\n",
              "      <td>[-0.5607839226722717, 0.01385028287768364, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>3.0</td>\n",
              "      <td>@flipkartsupport @rsprasad\\r\\r\\n@PMOIndia In h...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>10</th>\n",
              "      <td>Several Guernsey women have set up a group of ...</td>\n",
              "      <td>[-0.5054810047149658, 0.3916030824184418, -0.1...</td>\n",
              "      <td>positive</td>\n",
              "      <td>5.0</td>\n",
              "      <td>Several Guernsey women have set up a group of ...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>11</th>\n",
              "      <td>I took Plaquenil for 4 years. Now it's the hot...</td>\n",
              "      <td>[-0.7918602228164673, 0.6628591418266296, -0.4...</td>\n",
              "      <td>positive</td>\n",
              "      <td>3.0</td>\n",
              "      <td>I took Plaquenil for 4 years. Now it's the hot...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>12</th>\n",
              "      <td>CanÂt let this die. A little humor in these t...</td>\n",
              "      <td>[-0.6068148016929626, 0.4092712998390198, 0.18...</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>CanÂt let this die. A little humor in these t...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>13</th>\n",
              "      <td>IÂve been to the grocery store three times si...</td>\n",
              "      <td>[-1.2009631395339966, 0.18674977123737335, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>IÂve been to the grocery store three times si...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>14</th>\n",
              "      <td>That maybe there was a rioter out there who th...</td>\n",
              "      <td>[-0.9833343029022217, 0.002539500128477812, -0...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>That maybe there was a rioter out there who th...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>15</th>\n",
              "      <td>First they release and spread the virus Strip ...</td>\n",
              "      <td>[-0.903867781162262, 0.3173466622829437, -0.74...</td>\n",
              "      <td>positive</td>\n",
              "      <td>3.0</td>\n",
              "      <td>First they release and spread the virus Strip ...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>16</th>\n",
              "      <td>For about a year I have been toying with the i...</td>\n",
              "      <td>[-0.7246012091636658, 0.4053008258342743, -0.2...</td>\n",
              "      <td>positive</td>\n",
              "      <td>9.0</td>\n",
              "      <td>For about a year I have been toying with the i...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>17</th>\n",
              "      <td>Creation Consumer Finance in Belfast are now p...</td>\n",
              "      <td>[-0.08034359663724899, 0.9084559082984924, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>Creation Consumer Finance in Belfast are now p...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>18</th>\n",
              "      <td>\"Your going to lose people to the flu but you'...</td>\n",
              "      <td>[-1.6253035068511963, 0.23702141642570496, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>4.0</td>\n",
              "      <td>\"Your going to lose people to the flu but you'...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>19</th>\n",
              "      <td>If you are a #RetailWorker and your store is s...</td>\n",
              "      <td>[-0.18891872465610504, 1.0232254266738892, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>If you are a #RetailWorker and your store is s...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>20</th>\n",
              "      <td>I love this social distancing.. No one stand c...</td>\n",
              "      <td>[-0.7862111330032349, 0.17004938423633575, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>8.0</td>\n",
              "      <td>I love this social distancing..\\r\\r\\n\\r\\r\\nNo ...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>21</th>\n",
              "      <td>#Facebook Ads Fails to Reject COVID-19 Misinfo...</td>\n",
              "      <td>[0.09989737719297409, 0.21870799362659454, 0.2...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>#Facebook Ads Fails to Reject COVID-19 Misinfo...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>22</th>\n",
              "      <td>Lease prices decline in March as as the corona...</td>\n",
              "      <td>[-0.21414655447006226, 0.6170880794525146, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>Lease prices decline in March as as the corona...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>23</th>\n",
              "      <td>Complete Shutdown of Karnataka W.E.F 24th Marc...</td>\n",
              "      <td>[-1.0250476598739624, 0.7916482090950012, -0.4...</td>\n",
              "      <td>positive</td>\n",
              "      <td>5.0</td>\n",
              "      <td>Complete Shutdown of Karnataka W.E.F 24th Marc...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>24</th>\n",
              "      <td>@MobilePunch Another deceitful palliative in m...</td>\n",
              "      <td>[-0.967275083065033, 0.39687538146972656, -0.3...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>@MobilePunch Another deceitful palliative in m...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>25</th>\n",
              "      <td>I am anyways under lockdown since 6th March be...</td>\n",
              "      <td>[-0.8778604865074158, 0.4535127580165863, -0.8...</td>\n",
              "      <td>positive</td>\n",
              "      <td>4.0</td>\n",
              "      <td>I am anyways under lockdown since 6th March be...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>26</th>\n",
              "      <td>@KFCSA @yumbrands was at your store , the air ...</td>\n",
              "      <td>[-1.004093050956726, 0.5079272985458374, -0.48...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>@KFCSA @yumbrands was at your store , the air ...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>27</th>\n",
              "      <td>How to support and save local businesses durin...</td>\n",
              "      <td>[-0.7925586700439453, 0.2502853572368622, -0.0...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>How to support and save local businesses durin...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>28</th>\n",
              "      <td>This is the latest current information on supe...</td>\n",
              "      <td>[-1.155573844909668, 1.2174267768859863, -0.72...</td>\n",
              "      <td>positive</td>\n",
              "      <td>7.0</td>\n",
              "      <td>This is the latest current information on supe...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>29</th>\n",
              "      <td>If anyone witnesses any shops hiking their pri...</td>\n",
              "      <td>[-1.0366969108581543, 0.9876224398612976, 0.21...</td>\n",
              "      <td>positive</td>\n",
              "      <td>6.0</td>\n",
              "      <td>If anyone witnesses any shops hiking their pri...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>30</th>\n",
              "      <td>It's about time @eBay_UK stopped allowing peop...</td>\n",
              "      <td>[-0.6213818788528442, 0.8505221009254456, -0.0...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>It's about time @eBay_UK stopped allowing peop...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>31</th>\n",
              "      <td>sounds like a good idea - LA market offers spe...</td>\n",
              "      <td>[-0.8883647918701172, 0.09247803688049316, 0.0...</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>sounds like a good idea - LA market offers spe...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>32</th>\n",
              "      <td>No matter how they're ramping up efforts at #d...</td>\n",
              "      <td>[-0.6616833209991455, 0.4456593692302704, -0.1...</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>No matter how they're ramping up efforts at #d...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>33</th>\n",
              "      <td>I was wondering if a lovely supermarket would ...</td>\n",
              "      <td>[-0.7988455891609192, 0.3940075635910034, -0.2...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>I was wondering if a lovely supermarket would ...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>34</th>\n",
              "      <td>Telangana people, Please dont go out unless it...</td>\n",
              "      <td>[-0.859315812587738, 0.18060781061649323, -0.3...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>Telangana people, Please dont go out unless it...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>35</th>\n",
              "      <td>Idiots are panic purchasing food in bulk that ...</td>\n",
              "      <td>[-1.1440715789794922, 0.10256315022706985, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>Idiots are panic purchasing food in bulk that ...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>36</th>\n",
              "      <td>Following @BBVA_USA's initial offers last week...</td>\n",
              "      <td>[-0.4633345901966095, 0.6127039790153503, -0.0...</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>Following @BBVA_USA's initial offers last week...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>37</th>\n",
              "      <td>Please appreciate your supermarket delivery dr...</td>\n",
              "      <td>[-0.8110732436180115, 0.9440520405769348, -0.2...</td>\n",
              "      <td>positive</td>\n",
              "      <td>3.0</td>\n",
              "      <td>Please appreciate your supermarket delivery dr...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>38</th>\n",
              "      <td>When asked, ÂWhy does ADI continue to operate...</td>\n",
              "      <td>[-0.7378478050231934, 1.1133265495300293, -0.6...</td>\n",
              "      <td>positive</td>\n",
              "      <td>9.0</td>\n",
              "      <td>When asked, ÂWhy does ADI continue to operate...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>39</th>\n",
              "      <td>The long-term fallout of the #coronavirus lock...</td>\n",
              "      <td>[-0.4056348204612732, 0.8604288101196289, -0.2...</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>The long-term fallout of the #coronavirus lock...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>40</th>\n",
              "      <td>HELP US PACK THE PANTRIES I m live at 12 15 on...</td>\n",
              "      <td>[-1.0248322486877441, 0.3955387771129608, -0.5...</td>\n",
              "      <td>positive</td>\n",
              "      <td>4.0</td>\n",
              "      <td>HELP US PACK THE PANTRIES I m live at 12 15 on...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>41</th>\n",
              "      <td>Seeing whatÂs being left behind at grocery st...</td>\n",
              "      <td>[-0.7818620800971985, 0.35503625869750977, 0.1...</td>\n",
              "      <td>positive</td>\n",
              "      <td>4.0</td>\n",
              "      <td>Seeing whatÂs being left behind at grocery st...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>42</th>\n",
              "      <td>Everyone don t forget condoms when you are hoa...</td>\n",
              "      <td>[-1.7940707206726074, 0.559665322303772, -0.49...</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>Everyone don t forget condoms when you are hoa...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>43</th>\n",
              "      <td>If you come across any shops charging inflated...</td>\n",
              "      <td>[-0.878898024559021, 0.7265058755874634, 0.008...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>If you come across any shops charging inflated...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>44</th>\n",
              "      <td>New @SA_Update #consumer insights affecting ve...</td>\n",
              "      <td>[0.0033321159426122904, 0.9780365228652954, -0...</td>\n",
              "      <td>positive</td>\n",
              "      <td>6.0</td>\n",
              "      <td>New @SA_Update  #consumer insights affecting v...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>45</th>\n",
              "      <td>How is COVID-19 affecting the pork and commodi...</td>\n",
              "      <td>[-0.6315991282463074, 0.5254122018814087, -0.3...</td>\n",
              "      <td>positive</td>\n",
              "      <td>4.0</td>\n",
              "      <td>How is COVID-19 affecting the pork and commodi...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>46</th>\n",
              "      <td>Unbelievable https://t.co/fBrPYaxNH6</td>\n",
              "      <td>[-0.4117434322834015, 0.6890383362770081, 0.51...</td>\n",
              "      <td>positive</td>\n",
              "      <td>4.0</td>\n",
              "      <td>Unbelievable https://t.co/fBrPYaxNH6</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>47</th>\n",
              "      <td>How prepared are UK supermarkets to fulfill co...</td>\n",
              "      <td>[-0.5095536112785339, 0.48363006114959717, 0.0...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>How prepared are UK supermarkets to fulfill co...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>48</th>\n",
              "      <td>Quakertown Distiller Providing Hand Sanitizer ...</td>\n",
              "      <td>[-1.3492352962493896, 0.669184684753418, -0.38...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>Quakertown Distiller Providing Hand Sanitizer ...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>49</th>\n",
              "      <td>Trump's disastrous dumbfuckery about #coronavi...</td>\n",
              "      <td>[-0.7200496792793274, 0.3299054205417633, -0.4...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>Trump's disastrous dumbfuckery about #coronavi...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>\n",
              "    <div class=\"colab-df-buttons\">\n",
              "\n",
              "  <div class=\"colab-df-container\">\n",
              "    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-1fa53f72-e1a6-4ee6-88d9-cd5576eed3ee')\"\n",
              "            title=\"Convert this dataframe to an interactive table.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
              "    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
              "  </svg>\n",
              "    </button>\n",
              "\n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    .colab-df-buttons div {\n",
              "      margin-bottom: 4px;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "    <script>\n",
              "      const buttonEl =\n",
              "        document.querySelector('#df-1fa53f72-e1a6-4ee6-88d9-cd5576eed3ee button.colab-df-convert');\n",
              "      buttonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "      async function convertToInteractive(key) {\n",
              "        const element = document.querySelector('#df-1fa53f72-e1a6-4ee6-88d9-cd5576eed3ee');\n",
              "        const dataTable =\n",
              "          await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                    [key], {});\n",
              "        if (!dataTable) return;\n",
              "\n",
              "        const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "          + ' to learn more about interactive tables.';\n",
              "        element.innerHTML = '';\n",
              "        dataTable['output_type'] = 'display_data';\n",
              "        await google.colab.output.renderOutput(dataTable, element);\n",
              "        const docLink = document.createElement('div');\n",
              "        docLink.innerHTML = docLinkHtml;\n",
              "        element.appendChild(docLink);\n",
              "      }\n",
              "    </script>\n",
              "  </div>\n",
              "\n",
              "\n",
              "<div id=\"df-d72ec138-880c-413b-8564-40599ddcc0a2\">\n",
              "  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-d72ec138-880c-413b-8564-40599ddcc0a2')\"\n",
              "            title=\"Suggest charts.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "     width=\"24px\">\n",
              "    <g>\n",
              "        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
              "    </g>\n",
              "</svg>\n",
              "  </button>\n",
              "\n",
              "<style>\n",
              "  .colab-df-quickchart {\n",
              "      --bg-color: #E8F0FE;\n",
              "      --fill-color: #1967D2;\n",
              "      --hover-bg-color: #E2EBFA;\n",
              "      --hover-fill-color: #174EA6;\n",
              "      --disabled-fill-color: #AAA;\n",
              "      --disabled-bg-color: #DDD;\n",
              "  }\n",
              "\n",
              "  [theme=dark] .colab-df-quickchart {\n",
              "      --bg-color: #3B4455;\n",
              "      --fill-color: #D2E3FC;\n",
              "      --hover-bg-color: #434B5C;\n",
              "      --hover-fill-color: #FFFFFF;\n",
              "      --disabled-bg-color: #3B4455;\n",
              "      --disabled-fill-color: #666;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart {\n",
              "    background-color: var(--bg-color);\n",
              "    border: none;\n",
              "    border-radius: 50%;\n",
              "    cursor: pointer;\n",
              "    display: none;\n",
              "    fill: var(--fill-color);\n",
              "    height: 32px;\n",
              "    padding: 0;\n",
              "    width: 32px;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart:hover {\n",
              "    background-color: var(--hover-bg-color);\n",
              "    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "    fill: var(--button-hover-fill-color);\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart-complete:disabled,\n",
              "  .colab-df-quickchart-complete:disabled:hover {\n",
              "    background-color: var(--disabled-bg-color);\n",
              "    fill: var(--disabled-fill-color);\n",
              "    box-shadow: none;\n",
              "  }\n",
              "\n",
              "  .colab-df-spinner {\n",
              "    border: 2px solid var(--fill-color);\n",
              "    border-color: transparent;\n",
              "    border-bottom-color: var(--fill-color);\n",
              "    animation:\n",
              "      spin 1s steps(1) infinite;\n",
              "  }\n",
              "\n",
              "  @keyframes spin {\n",
              "    0% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "      border-left-color: var(--fill-color);\n",
              "    }\n",
              "    20% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    30% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    40% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    60% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    80% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "    90% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "  }\n",
              "</style>\n",
              "\n",
              "  <script>\n",
              "    async function quickchart(key) {\n",
              "      const quickchartButtonEl =\n",
              "        document.querySelector('#' + key + ' button');\n",
              "      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n",
              "      quickchartButtonEl.classList.add('colab-df-spinner');\n",
              "      try {\n",
              "        const charts = await google.colab.kernel.invokeFunction(\n",
              "            'suggestCharts', [key], {});\n",
              "      } catch (error) {\n",
              "        console.error('Error during call to suggestCharts:', error);\n",
              "      }\n",
              "      quickchartButtonEl.classList.remove('colab-df-spinner');\n",
              "      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n",
              "    }\n",
              "    (() => {\n",
              "      let quickchartButtonEl =\n",
              "        document.querySelector('#df-d72ec138-880c-413b-8564-40599ddcc0a2 button');\n",
              "      quickchartButtonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "    })();\n",
              "  </script>\n",
              "</div>\n",
              "    </div>\n",
              "  </div>\n"
            ]
          },
          "metadata": {},
          "execution_count": 33
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "preds"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        },
        "id": "UbEWiXSUO0Qb",
        "outputId": "b7ae6af2-3b84-4c6d-a997-d41163e474e0"
      },
      "execution_count": 34,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "                                             document  \\\n",
              "0   Over 45 tar sands projects that have already s...   \n",
              "1   I just got super excited because I found toile...   \n",
              "2   BE AFRAID, BE VERY AFRAIDÂINSLEE PROMOTES THE...   \n",
              "3   A lady fro @CheckersSA Brits tells me to hide ...   \n",
              "4   Just done an online shop and all the food esse...   \n",
              "5   @GavinNewsom so let me get this straight crowd...   \n",
              "6   NY: 18- to 49-year-olds make up more than half...   \n",
              "7   Emerging market debt prices reflect worst case...   \n",
              "8   do you clean your #supermarket items due to th...   \n",
              "9   @flipkartsupport @rsprasad @PMOIndia In his cr...   \n",
              "10  Several Guernsey women have set up a group of ...   \n",
              "11  I took Plaquenil for 4 years. Now it's the hot...   \n",
              "12  CanÂt let this die. A little humor in these t...   \n",
              "13  IÂve been to the grocery store three times si...   \n",
              "14  That maybe there was a rioter out there who th...   \n",
              "15  First they release and spread the virus Strip ...   \n",
              "16  For about a year I have been toying with the i...   \n",
              "17  Creation Consumer Finance in Belfast are now p...   \n",
              "18  \"Your going to lose people to the flu but you'...   \n",
              "19  If you are a #RetailWorker and your store is s...   \n",
              "20  I love this social distancing.. No one stand c...   \n",
              "21  #Facebook Ads Fails to Reject COVID-19 Misinfo...   \n",
              "22  Lease prices decline in March as as the corona...   \n",
              "23  Complete Shutdown of Karnataka W.E.F 24th Marc...   \n",
              "24  @MobilePunch Another deceitful palliative in m...   \n",
              "25  I am anyways under lockdown since 6th March be...   \n",
              "26  @KFCSA @yumbrands was at your store , the air ...   \n",
              "27  How to support and save local businesses durin...   \n",
              "28  This is the latest current information on supe...   \n",
              "29  If anyone witnesses any shops hiking their pri...   \n",
              "30  It's about time @eBay_UK stopped allowing peop...   \n",
              "31  sounds like a good idea - LA market offers spe...   \n",
              "32  No matter how they're ramping up efforts at #d...   \n",
              "33  I was wondering if a lovely supermarket would ...   \n",
              "34  Telangana people, Please dont go out unless it...   \n",
              "35  Idiots are panic purchasing food in bulk that ...   \n",
              "36  Following @BBVA_USA's initial offers last week...   \n",
              "37  Please appreciate your supermarket delivery dr...   \n",
              "38  When asked, ÂWhy does ADI continue to operate...   \n",
              "39  The long-term fallout of the #coronavirus lock...   \n",
              "40  HELP US PACK THE PANTRIES I m live at 12 15 on...   \n",
              "41  Seeing whatÂs being left behind at grocery st...   \n",
              "42  Everyone don t forget condoms when you are hoa...   \n",
              "43  If you come across any shops charging inflated...   \n",
              "44  New @SA_Update #consumer insights affecting ve...   \n",
              "45  How is COVID-19 affecting the pork and commodi...   \n",
              "46               Unbelievable https://t.co/fBrPYaxNH6   \n",
              "47  How prepared are UK supermarkets to fulfill co...   \n",
              "48  Quakertown Distiller Providing Hand Sanitizer ...   \n",
              "49  Trump's disastrous dumbfuckery about #coronavi...   \n",
              "\n",
              "                 sentence_embedding_small_bert_L2_128 sentiment  \\\n",
              "0   [-0.040878042578697205, 0.7422170639038086, -1...  positive   \n",
              "1   [-0.8823249340057373, 0.2473045289516449, -0.2...  positive   \n",
              "2   [-0.5860391855239868, 0.45967912673950195, -0....  positive   \n",
              "3   [-1.0504486560821533, 0.03315277025103569, -0....  positive   \n",
              "4   [-0.7228847742080688, 0.12011835724115372, -0....  positive   \n",
              "5   [-0.7876735329627991, -0.0005504372529685497, ...  positive   \n",
              "6   [-0.7093901634216309, 0.15827353298664093, -0....  positive   \n",
              "7   [-0.38020092248916626, 0.469475656747818, -1.0...  positive   \n",
              "8   [-0.9434630870819092, 0.15352500975131989, -0....  positive   \n",
              "9   [-0.5607839226722717, 0.01385028287768364, -0....  positive   \n",
              "10  [-0.5054810047149658, 0.3916030824184418, -0.1...  positive   \n",
              "11  [-0.7918602228164673, 0.6628591418266296, -0.4...  positive   \n",
              "12  [-0.6068148016929626, 0.4092712998390198, 0.18...  positive   \n",
              "13  [-1.2009631395339966, 0.18674977123737335, -0....  positive   \n",
              "14  [-0.9833343029022217, 0.002539500128477812, -0...  positive   \n",
              "15  [-0.903867781162262, 0.3173466622829437, -0.74...  positive   \n",
              "16  [-0.7246012091636658, 0.4053008258342743, -0.2...  positive   \n",
              "17  [-0.08034359663724899, 0.9084559082984924, -0....  positive   \n",
              "18  [-1.6253035068511963, 0.23702141642570496, -0....  positive   \n",
              "19  [-0.18891872465610504, 1.0232254266738892, -0....  positive   \n",
              "20  [-0.7862111330032349, 0.17004938423633575, -0....  positive   \n",
              "21  [0.09989737719297409, 0.21870799362659454, 0.2...  positive   \n",
              "22  [-0.21414655447006226, 0.6170880794525146, -0....  positive   \n",
              "23  [-1.0250476598739624, 0.7916482090950012, -0.4...  positive   \n",
              "24  [-0.967275083065033, 0.39687538146972656, -0.3...  positive   \n",
              "25  [-0.8778604865074158, 0.4535127580165863, -0.8...  positive   \n",
              "26  [-1.004093050956726, 0.5079272985458374, -0.48...  positive   \n",
              "27  [-0.7925586700439453, 0.2502853572368622, -0.0...  positive   \n",
              "28  [-1.155573844909668, 1.2174267768859863, -0.72...  positive   \n",
              "29  [-1.0366969108581543, 0.9876224398612976, 0.21...  positive   \n",
              "30  [-0.6213818788528442, 0.8505221009254456, -0.0...  positive   \n",
              "31  [-0.8883647918701172, 0.09247803688049316, 0.0...  positive   \n",
              "32  [-0.6616833209991455, 0.4456593692302704, -0.1...  positive   \n",
              "33  [-0.7988455891609192, 0.3940075635910034, -0.2...  positive   \n",
              "34  [-0.859315812587738, 0.18060781061649323, -0.3...  positive   \n",
              "35  [-1.1440715789794922, 0.10256315022706985, -0....  positive   \n",
              "36  [-0.4633345901966095, 0.6127039790153503, -0.0...  positive   \n",
              "37  [-0.8110732436180115, 0.9440520405769348, -0.2...  positive   \n",
              "38  [-0.7378478050231934, 1.1133265495300293, -0.6...  positive   \n",
              "39  [-0.4056348204612732, 0.8604288101196289, -0.2...  positive   \n",
              "40  [-1.0248322486877441, 0.3955387771129608, -0.5...  positive   \n",
              "41  [-0.7818620800971985, 0.35503625869750977, 0.1...  positive   \n",
              "42  [-1.7940707206726074, 0.559665322303772, -0.49...  positive   \n",
              "43  [-0.878898024559021, 0.7265058755874634, 0.008...  positive   \n",
              "44  [0.0033321159426122904, 0.9780365228652954, -0...  positive   \n",
              "45  [-0.6315991282463074, 0.5254122018814087, -0.3...  positive   \n",
              "46  [-0.4117434322834015, 0.6890383362770081, 0.51...  positive   \n",
              "47  [-0.5095536112785339, 0.48363006114959717, 0.0...  positive   \n",
              "48  [-1.3492352962493896, 0.669184684753418, -0.38...  positive   \n",
              "49  [-0.7200496792793274, 0.3299054205417633, -0.4...  positive   \n",
              "\n",
              "   sentiment_confidence                                               text  \\\n",
              "0                   4.0  Over 45 tar sands projects that have already s...   \n",
              "1                   1.0  I just got super excited because I found toile...   \n",
              "2                   3.0  BE AFRAID, BE VERY AFRAIDÂINSLEE PROMOTES THE...   \n",
              "3                   2.0  A lady fro @CheckersSA Brits tells me to hide ...   \n",
              "4                   3.0  Just done an online shop and all the food esse...   \n",
              "5                   2.0  @GavinNewsom  so let me get this straight crow...   \n",
              "6                   2.0  NY: 18- to 49-year-olds make up more than half...   \n",
              "7                   1.0  Emerging market debt prices reflect worst case...   \n",
              "8                   3.0  do you clean your #supermarket  items due to t...   \n",
              "9                   3.0  @flipkartsupport @rsprasad\\r\\r\\n@PMOIndia In h...   \n",
              "10                  5.0  Several Guernsey women have set up a group of ...   \n",
              "11                  3.0  I took Plaquenil for 4 years. Now it's the hot...   \n",
              "12                  2.0  CanÂt let this die. A little humor in these t...   \n",
              "13                  1.0  IÂve been to the grocery store three times si...   \n",
              "14                  1.0  That maybe there was a rioter out there who th...   \n",
              "15                  3.0  First they release and spread the virus Strip ...   \n",
              "16                  9.0  For about a year I have been toying with the i...   \n",
              "17                  1.0  Creation Consumer Finance in Belfast are now p...   \n",
              "18                  4.0  \"Your going to lose people to the flu but you'...   \n",
              "19                  2.0  If you are a #RetailWorker and your store is s...   \n",
              "20                  8.0  I love this social distancing..\\r\\r\\n\\r\\r\\nNo ...   \n",
              "21                  1.0  #Facebook Ads Fails to Reject COVID-19 Misinfo...   \n",
              "22                  1.0  Lease prices decline in March as as the corona...   \n",
              "23                  5.0  Complete Shutdown of Karnataka W.E.F 24th Marc...   \n",
              "24                  1.0  @MobilePunch Another deceitful palliative in m...   \n",
              "25                  4.0  I am anyways under lockdown since 6th March be...   \n",
              "26                  1.0  @KFCSA @yumbrands was at your store , the air ...   \n",
              "27                  1.0  How to support and save local businesses durin...   \n",
              "28                  7.0  This is the latest current information on supe...   \n",
              "29                  6.0  If anyone witnesses any shops hiking their pri...   \n",
              "30                  1.0  It's about time @eBay_UK stopped allowing peop...   \n",
              "31                  2.0  sounds like a good idea - LA market offers spe...   \n",
              "32                  2.0  No matter how they're ramping up efforts at #d...   \n",
              "33                  1.0  I was wondering if a lovely supermarket would ...   \n",
              "34                  1.0  Telangana people, Please dont go out unless it...   \n",
              "35                  1.0  Idiots are panic purchasing food in bulk that ...   \n",
              "36                  2.0  Following @BBVA_USA's initial offers last week...   \n",
              "37                  3.0  Please appreciate your supermarket delivery dr...   \n",
              "38                  9.0  When asked, ÂWhy does ADI continue to operate...   \n",
              "39                  2.0  The long-term fallout of the #coronavirus lock...   \n",
              "40                  4.0  HELP US PACK THE PANTRIES I m live at 12 15 on...   \n",
              "41                  4.0  Seeing whatÂs being left behind at grocery st...   \n",
              "42                  2.0  Everyone don t forget condoms when you are hoa...   \n",
              "43                  1.0  If you come across any shops charging inflated...   \n",
              "44                  6.0  New @SA_Update  #consumer insights affecting v...   \n",
              "45                  4.0  How is COVID-19 affecting the pork and commodi...   \n",
              "46                  4.0               Unbelievable https://t.co/fBrPYaxNH6   \n",
              "47                  1.0  How prepared are UK supermarkets to fulfill co...   \n",
              "48                  1.0  Quakertown Distiller Providing Hand Sanitizer ...   \n",
              "49                  1.0  Trump's disastrous dumbfuckery about #coronavi...   \n",
              "\n",
              "           y  \n",
              "0   positive  \n",
              "1   positive  \n",
              "2   positive  \n",
              "3   positive  \n",
              "4   negative  \n",
              "5   negative  \n",
              "6   negative  \n",
              "7   negative  \n",
              "8   positive  \n",
              "9   negative  \n",
              "10  negative  \n",
              "11  positive  \n",
              "12  negative  \n",
              "13  negative  \n",
              "14  positive  \n",
              "15  negative  \n",
              "16  positive  \n",
              "17  negative  \n",
              "18  negative  \n",
              "19  positive  \n",
              "20  positive  \n",
              "21  negative  \n",
              "22  positive  \n",
              "23  negative  \n",
              "24  negative  \n",
              "25  positive  \n",
              "26  negative  \n",
              "27  positive  \n",
              "28  positive  \n",
              "29  positive  \n",
              "30  negative  \n",
              "31  positive  \n",
              "32  positive  \n",
              "33  positive  \n",
              "34  positive  \n",
              "35  negative  \n",
              "36  negative  \n",
              "37  positive  \n",
              "38  positive  \n",
              "39  positive  \n",
              "40  positive  \n",
              "41  negative  \n",
              "42  positive  \n",
              "43  positive  \n",
              "44  positive  \n",
              "45  negative  \n",
              "46  positive  \n",
              "47  positive  \n",
              "48  positive  \n",
              "49  negative  "
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-b938eefd-cbeb-46de-a437-68d8f291dc36\" class=\"colab-df-container\">\n",
              "    <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>document</th>\n",
              "      <th>sentence_embedding_small_bert_L2_128</th>\n",
              "      <th>sentiment</th>\n",
              "      <th>sentiment_confidence</th>\n",
              "      <th>text</th>\n",
              "      <th>y</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>Over 45 tar sands projects that have already s...</td>\n",
              "      <td>[-0.040878042578697205, 0.7422170639038086, -1...</td>\n",
              "      <td>positive</td>\n",
              "      <td>4.0</td>\n",
              "      <td>Over 45 tar sands projects that have already s...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>I just got super excited because I found toile...</td>\n",
              "      <td>[-0.8823249340057373, 0.2473045289516449, -0.2...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>I just got super excited because I found toile...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>BE AFRAID, BE VERY AFRAIDÂINSLEE PROMOTES THE...</td>\n",
              "      <td>[-0.5860391855239868, 0.45967912673950195, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>3.0</td>\n",
              "      <td>BE AFRAID, BE VERY AFRAIDÂINSLEE PROMOTES THE...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>A lady fro @CheckersSA Brits tells me to hide ...</td>\n",
              "      <td>[-1.0504486560821533, 0.03315277025103569, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>A lady fro @CheckersSA Brits tells me to hide ...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>Just done an online shop and all the food esse...</td>\n",
              "      <td>[-0.7228847742080688, 0.12011835724115372, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>3.0</td>\n",
              "      <td>Just done an online shop and all the food esse...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>5</th>\n",
              "      <td>@GavinNewsom so let me get this straight crowd...</td>\n",
              "      <td>[-0.7876735329627991, -0.0005504372529685497, ...</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>@GavinNewsom  so let me get this straight crow...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>6</th>\n",
              "      <td>NY: 18- to 49-year-olds make up more than half...</td>\n",
              "      <td>[-0.7093901634216309, 0.15827353298664093, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>NY: 18- to 49-year-olds make up more than half...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>7</th>\n",
              "      <td>Emerging market debt prices reflect worst case...</td>\n",
              "      <td>[-0.38020092248916626, 0.469475656747818, -1.0...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>Emerging market debt prices reflect worst case...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>8</th>\n",
              "      <td>do you clean your #supermarket items due to th...</td>\n",
              "      <td>[-0.9434630870819092, 0.15352500975131989, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>3.0</td>\n",
              "      <td>do you clean your #supermarket  items due to t...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>9</th>\n",
              "      <td>@flipkartsupport @rsprasad @PMOIndia In his cr...</td>\n",
              "      <td>[-0.5607839226722717, 0.01385028287768364, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>3.0</td>\n",
              "      <td>@flipkartsupport @rsprasad\\r\\r\\n@PMOIndia In h...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>10</th>\n",
              "      <td>Several Guernsey women have set up a group of ...</td>\n",
              "      <td>[-0.5054810047149658, 0.3916030824184418, -0.1...</td>\n",
              "      <td>positive</td>\n",
              "      <td>5.0</td>\n",
              "      <td>Several Guernsey women have set up a group of ...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>11</th>\n",
              "      <td>I took Plaquenil for 4 years. Now it's the hot...</td>\n",
              "      <td>[-0.7918602228164673, 0.6628591418266296, -0.4...</td>\n",
              "      <td>positive</td>\n",
              "      <td>3.0</td>\n",
              "      <td>I took Plaquenil for 4 years. Now it's the hot...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>12</th>\n",
              "      <td>CanÂt let this die. A little humor in these t...</td>\n",
              "      <td>[-0.6068148016929626, 0.4092712998390198, 0.18...</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>CanÂt let this die. A little humor in these t...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>13</th>\n",
              "      <td>IÂve been to the grocery store three times si...</td>\n",
              "      <td>[-1.2009631395339966, 0.18674977123737335, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>IÂve been to the grocery store three times si...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>14</th>\n",
              "      <td>That maybe there was a rioter out there who th...</td>\n",
              "      <td>[-0.9833343029022217, 0.002539500128477812, -0...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>That maybe there was a rioter out there who th...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>15</th>\n",
              "      <td>First they release and spread the virus Strip ...</td>\n",
              "      <td>[-0.903867781162262, 0.3173466622829437, -0.74...</td>\n",
              "      <td>positive</td>\n",
              "      <td>3.0</td>\n",
              "      <td>First they release and spread the virus Strip ...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>16</th>\n",
              "      <td>For about a year I have been toying with the i...</td>\n",
              "      <td>[-0.7246012091636658, 0.4053008258342743, -0.2...</td>\n",
              "      <td>positive</td>\n",
              "      <td>9.0</td>\n",
              "      <td>For about a year I have been toying with the i...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>17</th>\n",
              "      <td>Creation Consumer Finance in Belfast are now p...</td>\n",
              "      <td>[-0.08034359663724899, 0.9084559082984924, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>Creation Consumer Finance in Belfast are now p...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>18</th>\n",
              "      <td>\"Your going to lose people to the flu but you'...</td>\n",
              "      <td>[-1.6253035068511963, 0.23702141642570496, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>4.0</td>\n",
              "      <td>\"Your going to lose people to the flu but you'...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>19</th>\n",
              "      <td>If you are a #RetailWorker and your store is s...</td>\n",
              "      <td>[-0.18891872465610504, 1.0232254266738892, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>If you are a #RetailWorker and your store is s...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>20</th>\n",
              "      <td>I love this social distancing.. No one stand c...</td>\n",
              "      <td>[-0.7862111330032349, 0.17004938423633575, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>8.0</td>\n",
              "      <td>I love this social distancing..\\r\\r\\n\\r\\r\\nNo ...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>21</th>\n",
              "      <td>#Facebook Ads Fails to Reject COVID-19 Misinfo...</td>\n",
              "      <td>[0.09989737719297409, 0.21870799362659454, 0.2...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>#Facebook Ads Fails to Reject COVID-19 Misinfo...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>22</th>\n",
              "      <td>Lease prices decline in March as as the corona...</td>\n",
              "      <td>[-0.21414655447006226, 0.6170880794525146, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>Lease prices decline in March as as the corona...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>23</th>\n",
              "      <td>Complete Shutdown of Karnataka W.E.F 24th Marc...</td>\n",
              "      <td>[-1.0250476598739624, 0.7916482090950012, -0.4...</td>\n",
              "      <td>positive</td>\n",
              "      <td>5.0</td>\n",
              "      <td>Complete Shutdown of Karnataka W.E.F 24th Marc...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>24</th>\n",
              "      <td>@MobilePunch Another deceitful palliative in m...</td>\n",
              "      <td>[-0.967275083065033, 0.39687538146972656, -0.3...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>@MobilePunch Another deceitful palliative in m...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>25</th>\n",
              "      <td>I am anyways under lockdown since 6th March be...</td>\n",
              "      <td>[-0.8778604865074158, 0.4535127580165863, -0.8...</td>\n",
              "      <td>positive</td>\n",
              "      <td>4.0</td>\n",
              "      <td>I am anyways under lockdown since 6th March be...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>26</th>\n",
              "      <td>@KFCSA @yumbrands was at your store , the air ...</td>\n",
              "      <td>[-1.004093050956726, 0.5079272985458374, -0.48...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>@KFCSA @yumbrands was at your store , the air ...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>27</th>\n",
              "      <td>How to support and save local businesses durin...</td>\n",
              "      <td>[-0.7925586700439453, 0.2502853572368622, -0.0...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>How to support and save local businesses durin...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>28</th>\n",
              "      <td>This is the latest current information on supe...</td>\n",
              "      <td>[-1.155573844909668, 1.2174267768859863, -0.72...</td>\n",
              "      <td>positive</td>\n",
              "      <td>7.0</td>\n",
              "      <td>This is the latest current information on supe...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>29</th>\n",
              "      <td>If anyone witnesses any shops hiking their pri...</td>\n",
              "      <td>[-1.0366969108581543, 0.9876224398612976, 0.21...</td>\n",
              "      <td>positive</td>\n",
              "      <td>6.0</td>\n",
              "      <td>If anyone witnesses any shops hiking their pri...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>30</th>\n",
              "      <td>It's about time @eBay_UK stopped allowing peop...</td>\n",
              "      <td>[-0.6213818788528442, 0.8505221009254456, -0.0...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>It's about time @eBay_UK stopped allowing peop...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>31</th>\n",
              "      <td>sounds like a good idea - LA market offers spe...</td>\n",
              "      <td>[-0.8883647918701172, 0.09247803688049316, 0.0...</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>sounds like a good idea - LA market offers spe...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>32</th>\n",
              "      <td>No matter how they're ramping up efforts at #d...</td>\n",
              "      <td>[-0.6616833209991455, 0.4456593692302704, -0.1...</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>No matter how they're ramping up efforts at #d...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>33</th>\n",
              "      <td>I was wondering if a lovely supermarket would ...</td>\n",
              "      <td>[-0.7988455891609192, 0.3940075635910034, -0.2...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>I was wondering if a lovely supermarket would ...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>34</th>\n",
              "      <td>Telangana people, Please dont go out unless it...</td>\n",
              "      <td>[-0.859315812587738, 0.18060781061649323, -0.3...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>Telangana people, Please dont go out unless it...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>35</th>\n",
              "      <td>Idiots are panic purchasing food in bulk that ...</td>\n",
              "      <td>[-1.1440715789794922, 0.10256315022706985, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>Idiots are panic purchasing food in bulk that ...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>36</th>\n",
              "      <td>Following @BBVA_USA's initial offers last week...</td>\n",
              "      <td>[-0.4633345901966095, 0.6127039790153503, -0.0...</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>Following @BBVA_USA's initial offers last week...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>37</th>\n",
              "      <td>Please appreciate your supermarket delivery dr...</td>\n",
              "      <td>[-0.8110732436180115, 0.9440520405769348, -0.2...</td>\n",
              "      <td>positive</td>\n",
              "      <td>3.0</td>\n",
              "      <td>Please appreciate your supermarket delivery dr...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>38</th>\n",
              "      <td>When asked, ÂWhy does ADI continue to operate...</td>\n",
              "      <td>[-0.7378478050231934, 1.1133265495300293, -0.6...</td>\n",
              "      <td>positive</td>\n",
              "      <td>9.0</td>\n",
              "      <td>When asked, ÂWhy does ADI continue to operate...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>39</th>\n",
              "      <td>The long-term fallout of the #coronavirus lock...</td>\n",
              "      <td>[-0.4056348204612732, 0.8604288101196289, -0.2...</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>The long-term fallout of the #coronavirus lock...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>40</th>\n",
              "      <td>HELP US PACK THE PANTRIES I m live at 12 15 on...</td>\n",
              "      <td>[-1.0248322486877441, 0.3955387771129608, -0.5...</td>\n",
              "      <td>positive</td>\n",
              "      <td>4.0</td>\n",
              "      <td>HELP US PACK THE PANTRIES I m live at 12 15 on...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>41</th>\n",
              "      <td>Seeing whatÂs being left behind at grocery st...</td>\n",
              "      <td>[-0.7818620800971985, 0.35503625869750977, 0.1...</td>\n",
              "      <td>positive</td>\n",
              "      <td>4.0</td>\n",
              "      <td>Seeing whatÂs being left behind at grocery st...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>42</th>\n",
              "      <td>Everyone don t forget condoms when you are hoa...</td>\n",
              "      <td>[-1.7940707206726074, 0.559665322303772, -0.49...</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>Everyone don t forget condoms when you are hoa...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>43</th>\n",
              "      <td>If you come across any shops charging inflated...</td>\n",
              "      <td>[-0.878898024559021, 0.7265058755874634, 0.008...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>If you come across any shops charging inflated...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>44</th>\n",
              "      <td>New @SA_Update #consumer insights affecting ve...</td>\n",
              "      <td>[0.0033321159426122904, 0.9780365228652954, -0...</td>\n",
              "      <td>positive</td>\n",
              "      <td>6.0</td>\n",
              "      <td>New @SA_Update  #consumer insights affecting v...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>45</th>\n",
              "      <td>How is COVID-19 affecting the pork and commodi...</td>\n",
              "      <td>[-0.6315991282463074, 0.5254122018814087, -0.3...</td>\n",
              "      <td>positive</td>\n",
              "      <td>4.0</td>\n",
              "      <td>How is COVID-19 affecting the pork and commodi...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>46</th>\n",
              "      <td>Unbelievable https://t.co/fBrPYaxNH6</td>\n",
              "      <td>[-0.4117434322834015, 0.6890383362770081, 0.51...</td>\n",
              "      <td>positive</td>\n",
              "      <td>4.0</td>\n",
              "      <td>Unbelievable https://t.co/fBrPYaxNH6</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>47</th>\n",
              "      <td>How prepared are UK supermarkets to fulfill co...</td>\n",
              "      <td>[-0.5095536112785339, 0.48363006114959717, 0.0...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>How prepared are UK supermarkets to fulfill co...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>48</th>\n",
              "      <td>Quakertown Distiller Providing Hand Sanitizer ...</td>\n",
              "      <td>[-1.3492352962493896, 0.669184684753418, -0.38...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>Quakertown Distiller Providing Hand Sanitizer ...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>49</th>\n",
              "      <td>Trump's disastrous dumbfuckery about #coronavi...</td>\n",
              "      <td>[-0.7200496792793274, 0.3299054205417633, -0.4...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>Trump's disastrous dumbfuckery about #coronavi...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>\n",
              "    <div class=\"colab-df-buttons\">\n",
              "\n",
              "  <div class=\"colab-df-container\">\n",
              "    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-b938eefd-cbeb-46de-a437-68d8f291dc36')\"\n",
              "            title=\"Convert this dataframe to an interactive table.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
              "    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
              "  </svg>\n",
              "    </button>\n",
              "\n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    .colab-df-buttons div {\n",
              "      margin-bottom: 4px;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "    <script>\n",
              "      const buttonEl =\n",
              "        document.querySelector('#df-b938eefd-cbeb-46de-a437-68d8f291dc36 button.colab-df-convert');\n",
              "      buttonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "      async function convertToInteractive(key) {\n",
              "        const element = document.querySelector('#df-b938eefd-cbeb-46de-a437-68d8f291dc36');\n",
              "        const dataTable =\n",
              "          await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                    [key], {});\n",
              "        if (!dataTable) return;\n",
              "\n",
              "        const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "          + ' to learn more about interactive tables.';\n",
              "        element.innerHTML = '';\n",
              "        dataTable['output_type'] = 'display_data';\n",
              "        await google.colab.output.renderOutput(dataTable, element);\n",
              "        const docLink = document.createElement('div');\n",
              "        docLink.innerHTML = docLinkHtml;\n",
              "        element.appendChild(docLink);\n",
              "      }\n",
              "    </script>\n",
              "  </div>\n",
              "\n",
              "\n",
              "<div id=\"df-9f6c5761-9c02-417c-8c83-eba54e0ae4d8\">\n",
              "  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-9f6c5761-9c02-417c-8c83-eba54e0ae4d8')\"\n",
              "            title=\"Suggest charts.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "     width=\"24px\">\n",
              "    <g>\n",
              "        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
              "    </g>\n",
              "</svg>\n",
              "  </button>\n",
              "\n",
              "<style>\n",
              "  .colab-df-quickchart {\n",
              "      --bg-color: #E8F0FE;\n",
              "      --fill-color: #1967D2;\n",
              "      --hover-bg-color: #E2EBFA;\n",
              "      --hover-fill-color: #174EA6;\n",
              "      --disabled-fill-color: #AAA;\n",
              "      --disabled-bg-color: #DDD;\n",
              "  }\n",
              "\n",
              "  [theme=dark] .colab-df-quickchart {\n",
              "      --bg-color: #3B4455;\n",
              "      --fill-color: #D2E3FC;\n",
              "      --hover-bg-color: #434B5C;\n",
              "      --hover-fill-color: #FFFFFF;\n",
              "      --disabled-bg-color: #3B4455;\n",
              "      --disabled-fill-color: #666;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart {\n",
              "    background-color: var(--bg-color);\n",
              "    border: none;\n",
              "    border-radius: 50%;\n",
              "    cursor: pointer;\n",
              "    display: none;\n",
              "    fill: var(--fill-color);\n",
              "    height: 32px;\n",
              "    padding: 0;\n",
              "    width: 32px;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart:hover {\n",
              "    background-color: var(--hover-bg-color);\n",
              "    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "    fill: var(--button-hover-fill-color);\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart-complete:disabled,\n",
              "  .colab-df-quickchart-complete:disabled:hover {\n",
              "    background-color: var(--disabled-bg-color);\n",
              "    fill: var(--disabled-fill-color);\n",
              "    box-shadow: none;\n",
              "  }\n",
              "\n",
              "  .colab-df-spinner {\n",
              "    border: 2px solid var(--fill-color);\n",
              "    border-color: transparent;\n",
              "    border-bottom-color: var(--fill-color);\n",
              "    animation:\n",
              "      spin 1s steps(1) infinite;\n",
              "  }\n",
              "\n",
              "  @keyframes spin {\n",
              "    0% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "      border-left-color: var(--fill-color);\n",
              "    }\n",
              "    20% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    30% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    40% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    60% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    80% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "    90% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "  }\n",
              "</style>\n",
              "\n",
              "  <script>\n",
              "    async function quickchart(key) {\n",
              "      const quickchartButtonEl =\n",
              "        document.querySelector('#' + key + ' button');\n",
              "      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n",
              "      quickchartButtonEl.classList.add('colab-df-spinner');\n",
              "      try {\n",
              "        const charts = await google.colab.kernel.invokeFunction(\n",
              "            'suggestCharts', [key], {});\n",
              "      } catch (error) {\n",
              "        console.error('Error during call to suggestCharts:', error);\n",
              "      }\n",
              "      quickchartButtonEl.classList.remove('colab-df-spinner');\n",
              "      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n",
              "    }\n",
              "    (() => {\n",
              "      let quickchartButtonEl =\n",
              "        document.querySelector('#df-9f6c5761-9c02-417c-8c83-eba54e0ae4d8 button');\n",
              "      quickchartButtonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "    })();\n",
              "  </script>\n",
              "</div>\n",
              "    </div>\n",
              "  </div>\n"
            ]
          },
          "metadata": {},
          "execution_count": 34
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "lVyOE2wV0fw_"
      },
      "source": [
        "# 4. Test the fitted pipe on new example"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 150
        },
        "id": "qdCUg2MR0PD2",
        "outputId": "3c6d4f10-f2ef-4fbf-8488-bf8be3857f92"
      },
      "source": [
        "fitted_pipe.predict(\"Everything is under control !\")"
      ],
      "execution_count": 35,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "sentence_detector_dl download started this may take some time.\n",
            "Approximate size to download 354.6 KB\n",
            "[OK!]\n",
            "Warning::Spark Session already created, some configs may not take.\n"
          ]
        },
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "                        sentence  \\\n",
              "0  Everything is under control !   \n",
              "\n",
              "                sentence_embedding_small_bert_L2_128 sentiment  \\\n",
              "0  [-1.6309462785720825, 0.7175763845443726, -0.7...  positive   \n",
              "\n",
              "  sentiment_confidence  \n",
              "0             0.999999  "
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-c0a2cca4-b35d-4d23-81bb-6fe79f8e6ea2\" class=\"colab-df-container\">\n",
              "    <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>sentence</th>\n",
              "      <th>sentence_embedding_small_bert_L2_128</th>\n",
              "      <th>sentiment</th>\n",
              "      <th>sentiment_confidence</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>Everything is under control !</td>\n",
              "      <td>[-1.6309462785720825, 0.7175763845443726, -0.7...</td>\n",
              "      <td>positive</td>\n",
              "      <td>0.999999</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>\n",
              "    <div class=\"colab-df-buttons\">\n",
              "\n",
              "  <div class=\"colab-df-container\">\n",
              "    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-c0a2cca4-b35d-4d23-81bb-6fe79f8e6ea2')\"\n",
              "            title=\"Convert this dataframe to an interactive table.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
              "    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
              "  </svg>\n",
              "    </button>\n",
              "\n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    .colab-df-buttons div {\n",
              "      margin-bottom: 4px;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "    <script>\n",
              "      const buttonEl =\n",
              "        document.querySelector('#df-c0a2cca4-b35d-4d23-81bb-6fe79f8e6ea2 button.colab-df-convert');\n",
              "      buttonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "      async function convertToInteractive(key) {\n",
              "        const element = document.querySelector('#df-c0a2cca4-b35d-4d23-81bb-6fe79f8e6ea2');\n",
              "        const dataTable =\n",
              "          await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                    [key], {});\n",
              "        if (!dataTable) return;\n",
              "\n",
              "        const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "          + ' to learn more about interactive tables.';\n",
              "        element.innerHTML = '';\n",
              "        dataTable['output_type'] = 'display_data';\n",
              "        await google.colab.output.renderOutput(dataTable, element);\n",
              "        const docLink = document.createElement('div');\n",
              "        docLink.innerHTML = docLinkHtml;\n",
              "        element.appendChild(docLink);\n",
              "      }\n",
              "    </script>\n",
              "  </div>\n",
              "\n",
              "    </div>\n",
              "  </div>\n"
            ]
          },
          "metadata": {},
          "execution_count": 35
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "xflpwrVjjBVD"
      },
      "source": [
        "## 5. Configure pipe training parameters"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "UtsAUGTmOTms",
        "outputId": "b535fdb8-eee3-4825-e3d5-74d4dd7b42a5"
      },
      "source": [
        "trainable_pipe.print_info()"
      ],
      "execution_count": 36,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "The following parameters are configurable for this NLU pipeline (You can copy paste the examples) :\n",
            ">>> component_list['bert_sentence_embeddings@sent_small_bert_L2_128'] has settable params:\n",
            "component_list['bert_sentence_embeddings@sent_small_bert_L2_128'].setBatchSize(8)              | Info: Size of every batch | Currently set to : 8\n",
            "component_list['bert_sentence_embeddings@sent_small_bert_L2_128'].setEngine('tensorflow')      | Info: Deep Learning engine used for this model | Currently set to : tensorflow\n",
            "component_list['bert_sentence_embeddings@sent_small_bert_L2_128'].setIsLong(False)             | Info: Use Long type instead of Int type for inputs buffer - Some Bert models require Long instead of Int. | Currently set to : False\n",
            "component_list['bert_sentence_embeddings@sent_small_bert_L2_128'].setMaxSentenceLength(128)    | Info: Max sentence length to process | Currently set to : 128\n",
            "component_list['bert_sentence_embeddings@sent_small_bert_L2_128'].setDimension(128)            | Info: Number of embedding dimensions | Currently set to : 128\n",
            "component_list['bert_sentence_embeddings@sent_small_bert_L2_128'].setCaseSensitive(False)      | Info: whether to ignore case in tokens for embeddings matching | Currently set to : False\n",
            "component_list['bert_sentence_embeddings@sent_small_bert_L2_128'].setStorageRef('sent_small_bert_L2_128')  | Info: unique reference name for identification | Currently set to : sent_small_bert_L2_128\n",
            ">>> component_list['document_assembler'] has settable params:\n",
            "component_list['document_assembler'].setCleanupMode('shrink')                                  | Info: possible values: disabled, inplace, inplace_full, shrink, shrink_full, each, each_full, delete_full | Currently set to : shrink\n",
            ">>> component_list['sentiment_dl@sent_small_bert_L2_128'] has settable params:\n",
            "component_list['sentiment_dl@sent_small_bert_L2_128'].setEngine('tensorflow')                  | Info: Deep Learning engine used for this model | Currently set to : tensorflow\n",
            "component_list['sentiment_dl@sent_small_bert_L2_128'].setThreshold(0.6)                        | Info: The minimum threshold for the final result otheriwse it will be neutral | Currently set to : 0.6\n",
            "component_list['sentiment_dl@sent_small_bert_L2_128'].setThresholdLabel('neutral')             | Info: In case the score is less than threshold, what should be the label. Default is neutral. | Currently set to : neutral\n",
            "component_list['sentiment_dl@sent_small_bert_L2_128'].setStorageRef('sent_small_bert_L2_128')  | Info: unique reference name for identification | Currently set to : sent_small_bert_L2_128\n"
          ]
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "2GJdDNV9jEIe"
      },
      "source": [
        "##6. Retrain with new parameters"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        },
        "id": "mptfvHx-MMMX",
        "outputId": "c647f370-bd30-43ef-d2a9-b7ffc1948686"
      },
      "source": [
        "# Train longer!\n",
        "trainable_pipe = nlp.load('train.sentiment')\n",
        "trainable_pipe['trainable_sentiment_dl'].setMaxEpochs(5)\n",
        "fitted_pipe = trainable_pipe.fit(train_df.iloc[:50])\n",
        "# predict with the trainable pipeline on dataset and get predictions\n",
        "preds = fitted_pipe.predict(train_df.iloc[:50],output_level='document')\n",
        "\n",
        "#sentence detector that is part of the pipe generates sone NaNs. lets drop them first\n",
        "preds.dropna(inplace=True)\n",
        "print(classification_report(preds['y'], preds['sentiment']))\n",
        "\n",
        "preds"
      ],
      "execution_count": 37,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Warning::Spark Session already created, some configs may not take.\n",
            "Warning::Spark Session already created, some configs may not take.\n",
            "sent_small_bert_L2_128 download started this may take some time.\n",
            "Approximate size to download 16.1 MB\n",
            "[OK!]\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "/usr/local/lib/python3.10/dist-packages/nlu/pipe/pipeline.py:149: SettingWithCopyWarning: \n",
            "A value is trying to be set on a copy of a slice from a DataFrame.\n",
            "Try using .loc[row_indexer,col_indexer] = value instead\n",
            "\n",
            "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
            "  dataset.y = dataset.y.apply(str)\n",
            "/usr/local/lib/python3.10/dist-packages/nlu/pipe/utils/data_conversion_utils.py:160: SettingWithCopyWarning: \n",
            "A value is trying to be set on a copy of a slice from a DataFrame.\n",
            "Try using .loc[row_indexer,col_indexer] = value instead\n",
            "\n",
            "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
            "  data['origin_index'] = data.index\n",
            "/usr/local/lib/python3.10/dist-packages/nlu/pipe/utils/data_conversion_utils.py:160: SettingWithCopyWarning: \n",
            "A value is trying to be set on a copy of a slice from a DataFrame.\n",
            "Try using .loc[row_indexer,col_indexer] = value instead\n",
            "\n",
            "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
            "  data['origin_index'] = data.index\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "              precision    recall  f1-score   support\n",
            "\n",
            "    negative       0.00      0.00      0.00        21\n",
            "    positive       0.58      1.00      0.73        29\n",
            "\n",
            "    accuracy                           0.58        50\n",
            "   macro avg       0.29      0.50      0.37        50\n",
            "weighted avg       0.34      0.58      0.43        50\n",
            "\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "/usr/local/lib/python3.10/dist-packages/nlu/pipe/extractors/extractor_methods/base_extractor_methods.py:356: SettingWithCopyWarning: \n",
            "A value is trying to be set on a copy of a slice from a DataFrame.\n",
            "Try using .loc[row_indexer,col_indexer] = value instead\n",
            "\n",
            "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
            "  df[cols_to_explode] = df[cols_to_explode].apply(pad_same_level_cols, axis=1)\n",
            "/usr/local/lib/python3.10/dist-packages/sklearn/metrics/_classification.py:1344: UndefinedMetricWarning: Precision and F-score are ill-defined and being set to 0.0 in labels with no predicted samples. Use `zero_division` parameter to control this behavior.\n",
            "  _warn_prf(average, modifier, msg_start, len(result))\n",
            "/usr/local/lib/python3.10/dist-packages/sklearn/metrics/_classification.py:1344: UndefinedMetricWarning: Precision and F-score are ill-defined and being set to 0.0 in labels with no predicted samples. Use `zero_division` parameter to control this behavior.\n",
            "  _warn_prf(average, modifier, msg_start, len(result))\n",
            "/usr/local/lib/python3.10/dist-packages/sklearn/metrics/_classification.py:1344: UndefinedMetricWarning: Precision and F-score are ill-defined and being set to 0.0 in labels with no predicted samples. Use `zero_division` parameter to control this behavior.\n",
            "  _warn_prf(average, modifier, msg_start, len(result))\n"
          ]
        },
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "                                             document  \\\n",
              "0   Over 45 tar sands projects that have already s...   \n",
              "1   I just got super excited because I found toile...   \n",
              "2   BE AFRAID, BE VERY AFRAIDÂINSLEE PROMOTES THE...   \n",
              "3   A lady fro @CheckersSA Brits tells me to hide ...   \n",
              "4   Just done an online shop and all the food esse...   \n",
              "5   @GavinNewsom so let me get this straight crowd...   \n",
              "6   NY: 18- to 49-year-olds make up more than half...   \n",
              "7   Emerging market debt prices reflect worst case...   \n",
              "8   do you clean your #supermarket items due to th...   \n",
              "9   @flipkartsupport @rsprasad @PMOIndia In his cr...   \n",
              "10  Several Guernsey women have set up a group of ...   \n",
              "11  I took Plaquenil for 4 years. Now it's the hot...   \n",
              "12  CanÂt let this die. A little humor in these t...   \n",
              "13  IÂve been to the grocery store three times si...   \n",
              "14  That maybe there was a rioter out there who th...   \n",
              "15  First they release and spread the virus Strip ...   \n",
              "16  For about a year I have been toying with the i...   \n",
              "17  Creation Consumer Finance in Belfast are now p...   \n",
              "18  \"Your going to lose people to the flu but you'...   \n",
              "19  If you are a #RetailWorker and your store is s...   \n",
              "20  I love this social distancing.. No one stand c...   \n",
              "21  #Facebook Ads Fails to Reject COVID-19 Misinfo...   \n",
              "22  Lease prices decline in March as as the corona...   \n",
              "23  Complete Shutdown of Karnataka W.E.F 24th Marc...   \n",
              "24  @MobilePunch Another deceitful palliative in m...   \n",
              "25  I am anyways under lockdown since 6th March be...   \n",
              "26  @KFCSA @yumbrands was at your store , the air ...   \n",
              "27  How to support and save local businesses durin...   \n",
              "28  This is the latest current information on supe...   \n",
              "29  If anyone witnesses any shops hiking their pri...   \n",
              "30  It's about time @eBay_UK stopped allowing peop...   \n",
              "31  sounds like a good idea - LA market offers spe...   \n",
              "32  No matter how they're ramping up efforts at #d...   \n",
              "33  I was wondering if a lovely supermarket would ...   \n",
              "34  Telangana people, Please dont go out unless it...   \n",
              "35  Idiots are panic purchasing food in bulk that ...   \n",
              "36  Following @BBVA_USA's initial offers last week...   \n",
              "37  Please appreciate your supermarket delivery dr...   \n",
              "38  When asked, ÂWhy does ADI continue to operate...   \n",
              "39  The long-term fallout of the #coronavirus lock...   \n",
              "40  HELP US PACK THE PANTRIES I m live at 12 15 on...   \n",
              "41  Seeing whatÂs being left behind at grocery st...   \n",
              "42  Everyone don t forget condoms when you are hoa...   \n",
              "43  If you come across any shops charging inflated...   \n",
              "44  New @SA_Update #consumer insights affecting ve...   \n",
              "45  How is COVID-19 affecting the pork and commodi...   \n",
              "46               Unbelievable https://t.co/fBrPYaxNH6   \n",
              "47  How prepared are UK supermarkets to fulfill co...   \n",
              "48  Quakertown Distiller Providing Hand Sanitizer ...   \n",
              "49  Trump's disastrous dumbfuckery about #coronavi...   \n",
              "\n",
              "                 sentence_embedding_small_bert_L2_128 sentiment  \\\n",
              "0   [-0.040878042578697205, 0.7422170639038086, -1...  positive   \n",
              "1   [-0.8823249340057373, 0.2473045289516449, -0.2...  positive   \n",
              "2   [-0.5860391855239868, 0.45967912673950195, -0....  positive   \n",
              "3   [-1.0504486560821533, 0.03315277025103569, -0....  positive   \n",
              "4   [-0.7228847742080688, 0.12011835724115372, -0....  positive   \n",
              "5   [-0.7876735329627991, -0.0005504372529685497, ...  positive   \n",
              "6   [-0.7093901634216309, 0.15827353298664093, -0....  positive   \n",
              "7   [-0.38020092248916626, 0.469475656747818, -1.0...  positive   \n",
              "8   [-0.9434630870819092, 0.15352500975131989, -0....  positive   \n",
              "9   [-0.5607839226722717, 0.01385028287768364, -0....  positive   \n",
              "10  [-0.5054810047149658, 0.3916030824184418, -0.1...  positive   \n",
              "11  [-0.7918602228164673, 0.6628591418266296, -0.4...  positive   \n",
              "12  [-0.6068148016929626, 0.4092712998390198, 0.18...  positive   \n",
              "13  [-1.2009631395339966, 0.18674977123737335, -0....  positive   \n",
              "14  [-0.9833343029022217, 0.002539500128477812, -0...  positive   \n",
              "15  [-0.903867781162262, 0.3173466622829437, -0.74...  positive   \n",
              "16  [-0.7246012091636658, 0.4053008258342743, -0.2...  positive   \n",
              "17  [-0.08034359663724899, 0.9084559082984924, -0....  positive   \n",
              "18  [-1.6253035068511963, 0.23702141642570496, -0....  positive   \n",
              "19  [-0.18891872465610504, 1.0232254266738892, -0....  positive   \n",
              "20  [-0.7862111330032349, 0.17004938423633575, -0....  positive   \n",
              "21  [0.09989737719297409, 0.21870799362659454, 0.2...  positive   \n",
              "22  [-0.21414655447006226, 0.6170880794525146, -0....  positive   \n",
              "23  [-1.0250476598739624, 0.7916482090950012, -0.4...  positive   \n",
              "24  [-0.967275083065033, 0.39687538146972656, -0.3...  positive   \n",
              "25  [-0.8778604865074158, 0.4535127580165863, -0.8...  positive   \n",
              "26  [-1.004093050956726, 0.5079272985458374, -0.48...  positive   \n",
              "27  [-0.7925586700439453, 0.2502853572368622, -0.0...  positive   \n",
              "28  [-1.155573844909668, 1.2174267768859863, -0.72...  positive   \n",
              "29  [-1.0366969108581543, 0.9876224398612976, 0.21...  positive   \n",
              "30  [-0.6213818788528442, 0.8505221009254456, -0.0...  positive   \n",
              "31  [-0.8883647918701172, 0.09247803688049316, 0.0...  positive   \n",
              "32  [-0.6616833209991455, 0.4456593692302704, -0.1...  positive   \n",
              "33  [-0.7988455891609192, 0.3940075635910034, -0.2...  positive   \n",
              "34  [-0.859315812587738, 0.18060781061649323, -0.3...  positive   \n",
              "35  [-1.1440715789794922, 0.10256315022706985, -0....  positive   \n",
              "36  [-0.4633345901966095, 0.6127039790153503, -0.0...  positive   \n",
              "37  [-0.8110732436180115, 0.9440520405769348, -0.2...  positive   \n",
              "38  [-0.7378478050231934, 1.1133265495300293, -0.6...  positive   \n",
              "39  [-0.4056348204612732, 0.8604288101196289, -0.2...  positive   \n",
              "40  [-1.0248322486877441, 0.3955387771129608, -0.5...  positive   \n",
              "41  [-0.7818620800971985, 0.35503625869750977, 0.1...  positive   \n",
              "42  [-1.7940707206726074, 0.559665322303772, -0.49...  positive   \n",
              "43  [-0.878898024559021, 0.7265058755874634, 0.008...  positive   \n",
              "44  [0.0033321159426122904, 0.9780365228652954, -0...  positive   \n",
              "45  [-0.6315991282463074, 0.5254122018814087, -0.3...  positive   \n",
              "46  [-0.4117434322834015, 0.6890383362770081, 0.51...  positive   \n",
              "47  [-0.5095536112785339, 0.48363006114959717, 0.0...  positive   \n",
              "48  [-1.3492352962493896, 0.669184684753418, -0.38...  positive   \n",
              "49  [-0.7200496792793274, 0.3299054205417633, -0.4...  positive   \n",
              "\n",
              "   sentiment_confidence                                               text  \\\n",
              "0                   3.0  Over 45 tar sands projects that have already s...   \n",
              "1                   2.0  I just got super excited because I found toile...   \n",
              "2                   2.0  BE AFRAID, BE VERY AFRAIDÂINSLEE PROMOTES THE...   \n",
              "3                   7.0  A lady fro @CheckersSA Brits tells me to hide ...   \n",
              "4                   1.0  Just done an online shop and all the food esse...   \n",
              "5                   7.0  @GavinNewsom  so let me get this straight crow...   \n",
              "6                   3.0  NY: 18- to 49-year-olds make up more than half...   \n",
              "7                   4.0  Emerging market debt prices reflect worst case...   \n",
              "8                   3.0  do you clean your #supermarket  items due to t...   \n",
              "9                   1.0  @flipkartsupport @rsprasad\\r\\r\\n@PMOIndia In h...   \n",
              "10                  6.0  Several Guernsey women have set up a group of ...   \n",
              "11                  2.0  I took Plaquenil for 4 years. Now it's the hot...   \n",
              "12                  1.0  CanÂt let this die. A little humor in these t...   \n",
              "13                  1.0  IÂve been to the grocery store three times si...   \n",
              "14                  8.0  That maybe there was a rioter out there who th...   \n",
              "15                  2.0  First they release and spread the virus Strip ...   \n",
              "16                  7.0  For about a year I have been toying with the i...   \n",
              "17                  2.0  Creation Consumer Finance in Belfast are now p...   \n",
              "18                  5.0  \"Your going to lose people to the flu but you'...   \n",
              "19                  5.0  If you are a #RetailWorker and your store is s...   \n",
              "20                  2.0  I love this social distancing..\\r\\r\\n\\r\\r\\nNo ...   \n",
              "21                  1.0  #Facebook Ads Fails to Reject COVID-19 Misinfo...   \n",
              "22                  1.0  Lease prices decline in March as as the corona...   \n",
              "23                  4.0  Complete Shutdown of Karnataka W.E.F 24th Marc...   \n",
              "24                  1.0  @MobilePunch Another deceitful palliative in m...   \n",
              "25                  3.0  I am anyways under lockdown since 6th March be...   \n",
              "26                  2.0  @KFCSA @yumbrands was at your store , the air ...   \n",
              "27                  1.0  How to support and save local businesses durin...   \n",
              "28                  4.0  This is the latest current information on supe...   \n",
              "29                  2.0  If anyone witnesses any shops hiking their pri...   \n",
              "30                  1.0  It's about time @eBay_UK stopped allowing peop...   \n",
              "31                  2.0  sounds like a good idea - LA market offers spe...   \n",
              "32                  1.0  No matter how they're ramping up efforts at #d...   \n",
              "33                  2.0  I was wondering if a lovely supermarket would ...   \n",
              "34                  1.0  Telangana people, Please dont go out unless it...   \n",
              "35                  1.0  Idiots are panic purchasing food in bulk that ...   \n",
              "36                  8.0  Following @BBVA_USA's initial offers last week...   \n",
              "37                  6.0  Please appreciate your supermarket delivery dr...   \n",
              "38                  1.0  When asked, ÂWhy does ADI continue to operate...   \n",
              "39                  8.0  The long-term fallout of the #coronavirus lock...   \n",
              "40                  2.0  HELP US PACK THE PANTRIES I m live at 12 15 on...   \n",
              "41                  2.0  Seeing whatÂs being left behind at grocery st...   \n",
              "42                  2.0  Everyone don t forget condoms when you are hoa...   \n",
              "43                  2.0  If you come across any shops charging inflated...   \n",
              "44                  3.0  New @SA_Update  #consumer insights affecting v...   \n",
              "45                  2.0  How is COVID-19 affecting the pork and commodi...   \n",
              "46                  1.0               Unbelievable https://t.co/fBrPYaxNH6   \n",
              "47                  3.0  How prepared are UK supermarkets to fulfill co...   \n",
              "48                  4.0  Quakertown Distiller Providing Hand Sanitizer ...   \n",
              "49                  4.0  Trump's disastrous dumbfuckery about #coronavi...   \n",
              "\n",
              "           y  \n",
              "0   positive  \n",
              "1   positive  \n",
              "2   positive  \n",
              "3   positive  \n",
              "4   negative  \n",
              "5   negative  \n",
              "6   negative  \n",
              "7   negative  \n",
              "8   positive  \n",
              "9   negative  \n",
              "10  negative  \n",
              "11  positive  \n",
              "12  negative  \n",
              "13  negative  \n",
              "14  positive  \n",
              "15  negative  \n",
              "16  positive  \n",
              "17  negative  \n",
              "18  negative  \n",
              "19  positive  \n",
              "20  positive  \n",
              "21  negative  \n",
              "22  positive  \n",
              "23  negative  \n",
              "24  negative  \n",
              "25  positive  \n",
              "26  negative  \n",
              "27  positive  \n",
              "28  positive  \n",
              "29  positive  \n",
              "30  negative  \n",
              "31  positive  \n",
              "32  positive  \n",
              "33  positive  \n",
              "34  positive  \n",
              "35  negative  \n",
              "36  negative  \n",
              "37  positive  \n",
              "38  positive  \n",
              "39  positive  \n",
              "40  positive  \n",
              "41  negative  \n",
              "42  positive  \n",
              "43  positive  \n",
              "44  positive  \n",
              "45  negative  \n",
              "46  positive  \n",
              "47  positive  \n",
              "48  positive  \n",
              "49  negative  "
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-6895dfc7-2824-4c9e-bbd9-12ccabaee80e\" class=\"colab-df-container\">\n",
              "    <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>document</th>\n",
              "      <th>sentence_embedding_small_bert_L2_128</th>\n",
              "      <th>sentiment</th>\n",
              "      <th>sentiment_confidence</th>\n",
              "      <th>text</th>\n",
              "      <th>y</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>Over 45 tar sands projects that have already s...</td>\n",
              "      <td>[-0.040878042578697205, 0.7422170639038086, -1...</td>\n",
              "      <td>positive</td>\n",
              "      <td>3.0</td>\n",
              "      <td>Over 45 tar sands projects that have already s...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>I just got super excited because I found toile...</td>\n",
              "      <td>[-0.8823249340057373, 0.2473045289516449, -0.2...</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>I just got super excited because I found toile...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>BE AFRAID, BE VERY AFRAIDÂINSLEE PROMOTES THE...</td>\n",
              "      <td>[-0.5860391855239868, 0.45967912673950195, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>BE AFRAID, BE VERY AFRAIDÂINSLEE PROMOTES THE...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>A lady fro @CheckersSA Brits tells me to hide ...</td>\n",
              "      <td>[-1.0504486560821533, 0.03315277025103569, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>7.0</td>\n",
              "      <td>A lady fro @CheckersSA Brits tells me to hide ...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>Just done an online shop and all the food esse...</td>\n",
              "      <td>[-0.7228847742080688, 0.12011835724115372, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>Just done an online shop and all the food esse...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>5</th>\n",
              "      <td>@GavinNewsom so let me get this straight crowd...</td>\n",
              "      <td>[-0.7876735329627991, -0.0005504372529685497, ...</td>\n",
              "      <td>positive</td>\n",
              "      <td>7.0</td>\n",
              "      <td>@GavinNewsom  so let me get this straight crow...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>6</th>\n",
              "      <td>NY: 18- to 49-year-olds make up more than half...</td>\n",
              "      <td>[-0.7093901634216309, 0.15827353298664093, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>3.0</td>\n",
              "      <td>NY: 18- to 49-year-olds make up more than half...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>7</th>\n",
              "      <td>Emerging market debt prices reflect worst case...</td>\n",
              "      <td>[-0.38020092248916626, 0.469475656747818, -1.0...</td>\n",
              "      <td>positive</td>\n",
              "      <td>4.0</td>\n",
              "      <td>Emerging market debt prices reflect worst case...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>8</th>\n",
              "      <td>do you clean your #supermarket items due to th...</td>\n",
              "      <td>[-0.9434630870819092, 0.15352500975131989, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>3.0</td>\n",
              "      <td>do you clean your #supermarket  items due to t...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>9</th>\n",
              "      <td>@flipkartsupport @rsprasad @PMOIndia In his cr...</td>\n",
              "      <td>[-0.5607839226722717, 0.01385028287768364, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>@flipkartsupport @rsprasad\\r\\r\\n@PMOIndia In h...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>10</th>\n",
              "      <td>Several Guernsey women have set up a group of ...</td>\n",
              "      <td>[-0.5054810047149658, 0.3916030824184418, -0.1...</td>\n",
              "      <td>positive</td>\n",
              "      <td>6.0</td>\n",
              "      <td>Several Guernsey women have set up a group of ...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>11</th>\n",
              "      <td>I took Plaquenil for 4 years. Now it's the hot...</td>\n",
              "      <td>[-0.7918602228164673, 0.6628591418266296, -0.4...</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>I took Plaquenil for 4 years. Now it's the hot...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>12</th>\n",
              "      <td>CanÂt let this die. A little humor in these t...</td>\n",
              "      <td>[-0.6068148016929626, 0.4092712998390198, 0.18...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>CanÂt let this die. A little humor in these t...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>13</th>\n",
              "      <td>IÂve been to the grocery store three times si...</td>\n",
              "      <td>[-1.2009631395339966, 0.18674977123737335, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>IÂve been to the grocery store three times si...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>14</th>\n",
              "      <td>That maybe there was a rioter out there who th...</td>\n",
              "      <td>[-0.9833343029022217, 0.002539500128477812, -0...</td>\n",
              "      <td>positive</td>\n",
              "      <td>8.0</td>\n",
              "      <td>That maybe there was a rioter out there who th...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>15</th>\n",
              "      <td>First they release and spread the virus Strip ...</td>\n",
              "      <td>[-0.903867781162262, 0.3173466622829437, -0.74...</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>First they release and spread the virus Strip ...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>16</th>\n",
              "      <td>For about a year I have been toying with the i...</td>\n",
              "      <td>[-0.7246012091636658, 0.4053008258342743, -0.2...</td>\n",
              "      <td>positive</td>\n",
              "      <td>7.0</td>\n",
              "      <td>For about a year I have been toying with the i...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>17</th>\n",
              "      <td>Creation Consumer Finance in Belfast are now p...</td>\n",
              "      <td>[-0.08034359663724899, 0.9084559082984924, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>Creation Consumer Finance in Belfast are now p...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>18</th>\n",
              "      <td>\"Your going to lose people to the flu but you'...</td>\n",
              "      <td>[-1.6253035068511963, 0.23702141642570496, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>5.0</td>\n",
              "      <td>\"Your going to lose people to the flu but you'...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>19</th>\n",
              "      <td>If you are a #RetailWorker and your store is s...</td>\n",
              "      <td>[-0.18891872465610504, 1.0232254266738892, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>5.0</td>\n",
              "      <td>If you are a #RetailWorker and your store is s...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>20</th>\n",
              "      <td>I love this social distancing.. No one stand c...</td>\n",
              "      <td>[-0.7862111330032349, 0.17004938423633575, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>I love this social distancing..\\r\\r\\n\\r\\r\\nNo ...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>21</th>\n",
              "      <td>#Facebook Ads Fails to Reject COVID-19 Misinfo...</td>\n",
              "      <td>[0.09989737719297409, 0.21870799362659454, 0.2...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>#Facebook Ads Fails to Reject COVID-19 Misinfo...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>22</th>\n",
              "      <td>Lease prices decline in March as as the corona...</td>\n",
              "      <td>[-0.21414655447006226, 0.6170880794525146, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>Lease prices decline in March as as the corona...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>23</th>\n",
              "      <td>Complete Shutdown of Karnataka W.E.F 24th Marc...</td>\n",
              "      <td>[-1.0250476598739624, 0.7916482090950012, -0.4...</td>\n",
              "      <td>positive</td>\n",
              "      <td>4.0</td>\n",
              "      <td>Complete Shutdown of Karnataka W.E.F 24th Marc...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>24</th>\n",
              "      <td>@MobilePunch Another deceitful palliative in m...</td>\n",
              "      <td>[-0.967275083065033, 0.39687538146972656, -0.3...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>@MobilePunch Another deceitful palliative in m...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>25</th>\n",
              "      <td>I am anyways under lockdown since 6th March be...</td>\n",
              "      <td>[-0.8778604865074158, 0.4535127580165863, -0.8...</td>\n",
              "      <td>positive</td>\n",
              "      <td>3.0</td>\n",
              "      <td>I am anyways under lockdown since 6th March be...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>26</th>\n",
              "      <td>@KFCSA @yumbrands was at your store , the air ...</td>\n",
              "      <td>[-1.004093050956726, 0.5079272985458374, -0.48...</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>@KFCSA @yumbrands was at your store , the air ...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>27</th>\n",
              "      <td>How to support and save local businesses durin...</td>\n",
              "      <td>[-0.7925586700439453, 0.2502853572368622, -0.0...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>How to support and save local businesses durin...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>28</th>\n",
              "      <td>This is the latest current information on supe...</td>\n",
              "      <td>[-1.155573844909668, 1.2174267768859863, -0.72...</td>\n",
              "      <td>positive</td>\n",
              "      <td>4.0</td>\n",
              "      <td>This is the latest current information on supe...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>29</th>\n",
              "      <td>If anyone witnesses any shops hiking their pri...</td>\n",
              "      <td>[-1.0366969108581543, 0.9876224398612976, 0.21...</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>If anyone witnesses any shops hiking their pri...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>30</th>\n",
              "      <td>It's about time @eBay_UK stopped allowing peop...</td>\n",
              "      <td>[-0.6213818788528442, 0.8505221009254456, -0.0...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>It's about time @eBay_UK stopped allowing peop...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>31</th>\n",
              "      <td>sounds like a good idea - LA market offers spe...</td>\n",
              "      <td>[-0.8883647918701172, 0.09247803688049316, 0.0...</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>sounds like a good idea - LA market offers spe...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>32</th>\n",
              "      <td>No matter how they're ramping up efforts at #d...</td>\n",
              "      <td>[-0.6616833209991455, 0.4456593692302704, -0.1...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>No matter how they're ramping up efforts at #d...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>33</th>\n",
              "      <td>I was wondering if a lovely supermarket would ...</td>\n",
              "      <td>[-0.7988455891609192, 0.3940075635910034, -0.2...</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>I was wondering if a lovely supermarket would ...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>34</th>\n",
              "      <td>Telangana people, Please dont go out unless it...</td>\n",
              "      <td>[-0.859315812587738, 0.18060781061649323, -0.3...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>Telangana people, Please dont go out unless it...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>35</th>\n",
              "      <td>Idiots are panic purchasing food in bulk that ...</td>\n",
              "      <td>[-1.1440715789794922, 0.10256315022706985, -0....</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>Idiots are panic purchasing food in bulk that ...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>36</th>\n",
              "      <td>Following @BBVA_USA's initial offers last week...</td>\n",
              "      <td>[-0.4633345901966095, 0.6127039790153503, -0.0...</td>\n",
              "      <td>positive</td>\n",
              "      <td>8.0</td>\n",
              "      <td>Following @BBVA_USA's initial offers last week...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>37</th>\n",
              "      <td>Please appreciate your supermarket delivery dr...</td>\n",
              "      <td>[-0.8110732436180115, 0.9440520405769348, -0.2...</td>\n",
              "      <td>positive</td>\n",
              "      <td>6.0</td>\n",
              "      <td>Please appreciate your supermarket delivery dr...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>38</th>\n",
              "      <td>When asked, ÂWhy does ADI continue to operate...</td>\n",
              "      <td>[-0.7378478050231934, 1.1133265495300293, -0.6...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>When asked, ÂWhy does ADI continue to operate...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>39</th>\n",
              "      <td>The long-term fallout of the #coronavirus lock...</td>\n",
              "      <td>[-0.4056348204612732, 0.8604288101196289, -0.2...</td>\n",
              "      <td>positive</td>\n",
              "      <td>8.0</td>\n",
              "      <td>The long-term fallout of the #coronavirus lock...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>40</th>\n",
              "      <td>HELP US PACK THE PANTRIES I m live at 12 15 on...</td>\n",
              "      <td>[-1.0248322486877441, 0.3955387771129608, -0.5...</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>HELP US PACK THE PANTRIES I m live at 12 15 on...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>41</th>\n",
              "      <td>Seeing whatÂs being left behind at grocery st...</td>\n",
              "      <td>[-0.7818620800971985, 0.35503625869750977, 0.1...</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>Seeing whatÂs being left behind at grocery st...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>42</th>\n",
              "      <td>Everyone don t forget condoms when you are hoa...</td>\n",
              "      <td>[-1.7940707206726074, 0.559665322303772, -0.49...</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>Everyone don t forget condoms when you are hoa...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>43</th>\n",
              "      <td>If you come across any shops charging inflated...</td>\n",
              "      <td>[-0.878898024559021, 0.7265058755874634, 0.008...</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>If you come across any shops charging inflated...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>44</th>\n",
              "      <td>New @SA_Update #consumer insights affecting ve...</td>\n",
              "      <td>[0.0033321159426122904, 0.9780365228652954, -0...</td>\n",
              "      <td>positive</td>\n",
              "      <td>3.0</td>\n",
              "      <td>New @SA_Update  #consumer insights affecting v...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>45</th>\n",
              "      <td>How is COVID-19 affecting the pork and commodi...</td>\n",
              "      <td>[-0.6315991282463074, 0.5254122018814087, -0.3...</td>\n",
              "      <td>positive</td>\n",
              "      <td>2.0</td>\n",
              "      <td>How is COVID-19 affecting the pork and commodi...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>46</th>\n",
              "      <td>Unbelievable https://t.co/fBrPYaxNH6</td>\n",
              "      <td>[-0.4117434322834015, 0.6890383362770081, 0.51...</td>\n",
              "      <td>positive</td>\n",
              "      <td>1.0</td>\n",
              "      <td>Unbelievable https://t.co/fBrPYaxNH6</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>47</th>\n",
              "      <td>How prepared are UK supermarkets to fulfill co...</td>\n",
              "      <td>[-0.5095536112785339, 0.48363006114959717, 0.0...</td>\n",
              "      <td>positive</td>\n",
              "      <td>3.0</td>\n",
              "      <td>How prepared are UK supermarkets to fulfill co...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>48</th>\n",
              "      <td>Quakertown Distiller Providing Hand Sanitizer ...</td>\n",
              "      <td>[-1.3492352962493896, 0.669184684753418, -0.38...</td>\n",
              "      <td>positive</td>\n",
              "      <td>4.0</td>\n",
              "      <td>Quakertown Distiller Providing Hand Sanitizer ...</td>\n",
              "      <td>positive</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>49</th>\n",
              "      <td>Trump's disastrous dumbfuckery about #coronavi...</td>\n",
              "      <td>[-0.7200496792793274, 0.3299054205417633, -0.4...</td>\n",
              "      <td>positive</td>\n",
              "      <td>4.0</td>\n",
              "      <td>Trump's disastrous dumbfuckery about #coronavi...</td>\n",
              "      <td>negative</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>\n",
              "    <div class=\"colab-df-buttons\">\n",
              "\n",
              "  <div class=\"colab-df-container\">\n",
              "    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-6895dfc7-2824-4c9e-bbd9-12ccabaee80e')\"\n",
              "            title=\"Convert this dataframe to an interactive table.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
              "    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
              "  </svg>\n",
              "    </button>\n",
              "\n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    .colab-df-buttons div {\n",
              "      margin-bottom: 4px;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "    <script>\n",
              "      const buttonEl =\n",
              "        document.querySelector('#df-6895dfc7-2824-4c9e-bbd9-12ccabaee80e button.colab-df-convert');\n",
              "      buttonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "      async function convertToInteractive(key) {\n",
              "        const element = document.querySelector('#df-6895dfc7-2824-4c9e-bbd9-12ccabaee80e');\n",
              "        const dataTable =\n",
              "          await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                    [key], {});\n",
              "        if (!dataTable) return;\n",
              "\n",
              "        const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "          + ' to learn more about interactive tables.';\n",
              "        element.innerHTML = '';\n",
              "        dataTable['output_type'] = 'display_data';\n",
              "        await google.colab.output.renderOutput(dataTable, element);\n",
              "        const docLink = document.createElement('div');\n",
              "        docLink.innerHTML = docLinkHtml;\n",
              "        element.appendChild(docLink);\n",
              "      }\n",
              "    </script>\n",
              "  </div>\n",
              "\n",
              "\n",
              "<div id=\"df-e1c1e155-0657-4569-bf88-352bacae8bf2\">\n",
              "  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-e1c1e155-0657-4569-bf88-352bacae8bf2')\"\n",
              "            title=\"Suggest charts.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "     width=\"24px\">\n",
              "    <g>\n",
              "        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
              "    </g>\n",
              "</svg>\n",
              "  </button>\n",
              "\n",
              "<style>\n",
              "  .colab-df-quickchart {\n",
              "      --bg-color: #E8F0FE;\n",
              "      --fill-color: #1967D2;\n",
              "      --hover-bg-color: #E2EBFA;\n",
              "      --hover-fill-color: #174EA6;\n",
              "      --disabled-fill-color: #AAA;\n",
              "      --disabled-bg-color: #DDD;\n",
              "  }\n",
              "\n",
              "  [theme=dark] .colab-df-quickchart {\n",
              "      --bg-color: #3B4455;\n",
              "      --fill-color: #D2E3FC;\n",
              "      --hover-bg-color: #434B5C;\n",
              "      --hover-fill-color: #FFFFFF;\n",
              "      --disabled-bg-color: #3B4455;\n",
              "      --disabled-fill-color: #666;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart {\n",
              "    background-color: var(--bg-color);\n",
              "    border: none;\n",
              "    border-radius: 50%;\n",
              "    cursor: pointer;\n",
              "    display: none;\n",
              "    fill: var(--fill-color);\n",
              "    height: 32px;\n",
              "    padding: 0;\n",
              "    width: 32px;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart:hover {\n",
              "    background-color: var(--hover-bg-color);\n",
              "    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "    fill: var(--button-hover-fill-color);\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart-complete:disabled,\n",
              "  .colab-df-quickchart-complete:disabled:hover {\n",
              "    background-color: var(--disabled-bg-color);\n",
              "    fill: var(--disabled-fill-color);\n",
              "    box-shadow: none;\n",
              "  }\n",
              "\n",
              "  .colab-df-spinner {\n",
              "    border: 2px solid var(--fill-color);\n",
              "    border-color: transparent;\n",
              "    border-bottom-color: var(--fill-color);\n",
              "    animation:\n",
              "      spin 1s steps(1) infinite;\n",
              "  }\n",
              "\n",
              "  @keyframes spin {\n",
              "    0% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "      border-left-color: var(--fill-color);\n",
              "    }\n",
              "    20% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    30% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    40% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    60% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    80% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "    90% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "  }\n",
              "</style>\n",
              "\n",
              "  <script>\n",
              "    async function quickchart(key) {\n",
              "      const quickchartButtonEl =\n",
              "        document.querySelector('#' + key + ' button');\n",
              "      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n",
              "      quickchartButtonEl.classList.add('colab-df-spinner');\n",
              "      try {\n",
              "        const charts = await google.colab.kernel.invokeFunction(\n",
              "            'suggestCharts', [key], {});\n",
              "      } catch (error) {\n",
              "        console.error('Error during call to suggestCharts:', error);\n",
              "      }\n",
              "      quickchartButtonEl.classList.remove('colab-df-spinner');\n",
              "      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n",
              "    }\n",
              "    (() => {\n",
              "      let quickchartButtonEl =\n",
              "        document.querySelector('#df-e1c1e155-0657-4569-bf88-352bacae8bf2 button');\n",
              "      quickchartButtonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "    })();\n",
              "  </script>\n",
              "</div>\n",
              "    </div>\n",
              "  </div>\n"
            ]
          },
          "metadata": {},
          "execution_count": 37
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "qFoT-s1MjTSS"
      },
      "source": [
        "# 7. Try training with different Embeddings"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "nxWFzQOhjWC8",
        "outputId": "d5465274-e8a1-4443-f2b4-950f2387cfbc"
      },
      "source": [
        "# We can use nlu.print_components(action='embed_sentence') to see every possibler sentence embedding we could use. Lets use bert!\n",
        "nlp.nlu.print_components(action='embed_sentence')"
      ],
      "execution_count": 39,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "For language <am> NLU provides the following Models : \n",
            "nlu.load('am.embed_sentence.xlm_roberta') returns Spark NLP model_anno_obj sent_xlm_roberta_base_finetuned_amharic\n",
            "For language <de> NLU provides the following Models : \n",
            "nlu.load('de.embed_sentence.bert.base_cased') returns Spark NLP model_anno_obj sent_bert_base_cased\n",
            "For language <el> NLU provides the following Models : \n",
            "nlu.load('el.embed_sentence.bert.base_uncased') returns Spark NLP model_anno_obj sent_bert_base_uncased\n",
            "For language <en> NLU provides the following Models : \n",
            "nlu.load('en.embed_sentence') returns Spark NLP model_anno_obj tfhub_use\n",
            "nlu.load('en.embed_sentence.albert') returns Spark NLP model_anno_obj albert_base_uncased\n",
            "nlu.load('en.embed_sentence.bert') returns Spark NLP model_anno_obj sent_bert_base_uncased\n",
            "nlu.load('en.embed_sentence.bert.base_uncased_legal') returns Spark NLP model_anno_obj sent_bert_base_uncased_legal\n",
            "nlu.load('en.embed_sentence.bert.finetuned') returns Spark NLP model_anno_obj sbert_setfit_finetuned_financial_text_classification\n",
            "nlu.load('en.embed_sentence.bert.pubmed') returns Spark NLP model_anno_obj sent_bert_pubmed\n",
            "nlu.load('en.embed_sentence.bert.pubmed_squad2') returns Spark NLP model_anno_obj sent_bert_pubmed_squad2\n",
            "nlu.load('en.embed_sentence.bert.wiki_books') returns Spark NLP model_anno_obj sent_bert_wiki_books\n",
            "nlu.load('en.embed_sentence.bert.wiki_books_mnli') returns Spark NLP model_anno_obj sent_bert_wiki_books_mnli\n",
            "nlu.load('en.embed_sentence.bert.wiki_books_qnli') returns Spark NLP model_anno_obj sent_bert_wiki_books_qnli\n",
            "nlu.load('en.embed_sentence.bert.wiki_books_qqp') returns Spark NLP model_anno_obj sent_bert_wiki_books_qqp\n",
            "nlu.load('en.embed_sentence.bert.wiki_books_squad2') returns Spark NLP model_anno_obj sent_bert_wiki_books_squad2\n",
            "nlu.load('en.embed_sentence.bert.wiki_books_sst2') returns Spark NLP model_anno_obj sent_bert_wiki_books_sst2\n",
            "nlu.load('en.embed_sentence.bert_base_cased') returns Spark NLP model_anno_obj sent_bert_base_cased\n",
            "nlu.load('en.embed_sentence.bert_base_uncased') returns Spark NLP model_anno_obj sent_bert_base_uncased\n",
            "nlu.load('en.embed_sentence.bert_large_cased') returns Spark NLP model_anno_obj sent_bert_large_cased\n",
            "nlu.load('en.embed_sentence.bert_large_uncased') returns Spark NLP model_anno_obj sent_bert_large_uncased\n",
            "nlu.load('en.embed_sentence.bert_use_cmlm_en_base') returns Spark NLP model_anno_obj sent_bert_use_cmlm_en_base\n",
            "nlu.load('en.embed_sentence.bert_use_cmlm_en_large') returns Spark NLP model_anno_obj sent_bert_use_cmlm_en_large\n",
            "nlu.load('en.embed_sentence.biobert.clinical_base_cased') returns Spark NLP model_anno_obj sent_biobert_clinical_base_cased\n",
            "nlu.load('en.embed_sentence.biobert.discharge_base_cased') returns Spark NLP model_anno_obj sent_biobert_discharge_base_cased\n",
            "nlu.load('en.embed_sentence.biobert.pmc_base_cased') returns Spark NLP model_anno_obj sent_biobert_pmc_base_cased\n",
            "nlu.load('en.embed_sentence.biobert.pubmed_base_cased') returns Spark NLP model_anno_obj sent_biobert_pubmed_base_cased\n",
            "nlu.load('en.embed_sentence.biobert.pubmed_large_cased') returns Spark NLP model_anno_obj sent_biobert_pubmed_large_cased\n",
            "nlu.load('en.embed_sentence.biobert.pubmed_pmc_base_cased') returns Spark NLP model_anno_obj sent_biobert_pubmed_pmc_base_cased\n",
            "nlu.load('en.embed_sentence.covidbert.large_uncased') returns Spark NLP model_anno_obj sent_covidbert_large_uncased\n",
            "nlu.load('en.embed_sentence.distil_roberta.distilled_base') returns Spark NLP model_anno_obj sent_distilroberta_base\n",
            "nlu.load('en.embed_sentence.doc2vec') returns Spark NLP model_anno_obj doc2vec_gigaword_300\n",
            "nlu.load('en.embed_sentence.doc2vec.gigaword_300') returns Spark NLP model_anno_obj doc2vec_gigaword_300\n",
            "nlu.load('en.embed_sentence.doc2vec.gigaword_wiki_300') returns Spark NLP model_anno_obj doc2vec_gigaword_wiki_300\n",
            "nlu.load('en.embed_sentence.electra') returns Spark NLP model_anno_obj sent_electra_small_uncased\n",
            "nlu.load('en.embed_sentence.electra_base_uncased') returns Spark NLP model_anno_obj sent_electra_base_uncased\n",
            "nlu.load('en.embed_sentence.electra_large_uncased') returns Spark NLP model_anno_obj sent_electra_large_uncased\n",
            "nlu.load('en.embed_sentence.electra_small_uncased') returns Spark NLP model_anno_obj sent_electra_small_uncased\n",
            "nlu.load('en.embed_sentence.roberta.base') returns Spark NLP model_anno_obj sent_roberta_base\n",
            "nlu.load('en.embed_sentence.roberta.large') returns Spark NLP model_anno_obj sent_roberta_large\n",
            "nlu.load('en.embed_sentence.small_bert_L10_128') returns Spark NLP model_anno_obj sent_small_bert_L10_128\n",
            "nlu.load('en.embed_sentence.small_bert_L10_256') returns Spark NLP model_anno_obj sent_small_bert_L10_256\n",
            "nlu.load('en.embed_sentence.small_bert_L10_512') returns Spark NLP model_anno_obj sent_small_bert_L10_512\n",
            "nlu.load('en.embed_sentence.small_bert_L10_768') returns Spark NLP model_anno_obj sent_small_bert_L10_768\n",
            "nlu.load('en.embed_sentence.small_bert_L12_128') returns Spark NLP model_anno_obj sent_small_bert_L12_128\n",
            "nlu.load('en.embed_sentence.small_bert_L12_256') returns Spark NLP model_anno_obj sent_small_bert_L12_256\n",
            "nlu.load('en.embed_sentence.small_bert_L12_512') returns Spark NLP model_anno_obj sent_small_bert_L12_512\n",
            "nlu.load('en.embed_sentence.small_bert_L12_768') returns Spark NLP model_anno_obj sent_small_bert_L12_768\n",
            "nlu.load('en.embed_sentence.small_bert_L2_128') returns Spark NLP model_anno_obj sent_small_bert_L2_128\n",
            "nlu.load('en.embed_sentence.small_bert_L2_256') returns Spark NLP model_anno_obj sent_small_bert_L2_256\n",
            "nlu.load('en.embed_sentence.small_bert_L2_512') returns Spark NLP model_anno_obj sent_small_bert_L2_512\n",
            "nlu.load('en.embed_sentence.small_bert_L2_768') returns Spark NLP model_anno_obj sent_small_bert_L2_768\n",
            "nlu.load('en.embed_sentence.small_bert_L4_128') returns Spark NLP model_anno_obj sent_small_bert_L4_128\n",
            "nlu.load('en.embed_sentence.small_bert_L4_256') returns Spark NLP model_anno_obj sent_small_bert_L4_256\n",
            "nlu.load('en.embed_sentence.small_bert_L4_512') returns Spark NLP model_anno_obj sent_small_bert_L4_512\n",
            "nlu.load('en.embed_sentence.small_bert_L4_768') returns Spark NLP model_anno_obj sent_small_bert_L4_768\n",
            "nlu.load('en.embed_sentence.small_bert_L6_128') returns Spark NLP model_anno_obj sent_small_bert_L6_128\n",
            "nlu.load('en.embed_sentence.small_bert_L6_256') returns Spark NLP model_anno_obj sent_small_bert_L6_256\n",
            "nlu.load('en.embed_sentence.small_bert_L6_512') returns Spark NLP model_anno_obj sent_small_bert_L6_512\n",
            "nlu.load('en.embed_sentence.small_bert_L6_768') returns Spark NLP model_anno_obj sent_small_bert_L6_768\n",
            "nlu.load('en.embed_sentence.small_bert_L8_128') returns Spark NLP model_anno_obj sent_small_bert_L8_128\n",
            "nlu.load('en.embed_sentence.small_bert_L8_256') returns Spark NLP model_anno_obj sent_small_bert_L8_256\n",
            "nlu.load('en.embed_sentence.small_bert_L8_512') returns Spark NLP model_anno_obj sent_small_bert_L8_512\n",
            "nlu.load('en.embed_sentence.small_bert_L8_768') returns Spark NLP model_anno_obj sent_small_bert_L8_768\n",
            "nlu.load('en.embed_sentence.tfhub_use') returns Spark NLP model_anno_obj tfhub_use\n",
            "nlu.load('en.embed_sentence.tfhub_use.lg') returns Spark NLP model_anno_obj tfhub_use_lg\n",
            "nlu.load('en.embed_sentence.use') returns Spark NLP model_anno_obj tfhub_use\n",
            "nlu.load('en.embed_sentence.use.lg') returns Spark NLP model_anno_obj tfhub_use_lg\n",
            "For language <es> NLU provides the following Models : \n",
            "nlu.load('es.embed_sentence.bert.base_cased') returns Spark NLP model_anno_obj sent_bert_base_cased\n",
            "nlu.load('es.embed_sentence.bert.base_uncased') returns Spark NLP model_anno_obj sent_bert_base_uncased\n",
            "For language <fi> NLU provides the following Models : \n",
            "nlu.load('fi.embed_sentence.bert') returns Spark NLP model_anno_obj bert_base_finnish_uncased\n",
            "nlu.load('fi.embed_sentence.bert.cased') returns Spark NLP model_anno_obj bert_base_finnish_cased\n",
            "nlu.load('fi.embed_sentence.bert.uncased') returns Spark NLP model_anno_obj bert_base_finnish_uncased\n",
            "For language <ha> NLU provides the following Models : \n",
            "nlu.load('ha.embed_sentence.xlm_roberta') returns Spark NLP model_anno_obj sent_xlm_roberta_base_finetuned_hausa\n",
            "For language <ig> NLU provides the following Models : \n",
            "nlu.load('ig.embed_sentence.xlm_roberta') returns Spark NLP model_anno_obj sent_xlm_roberta_base_finetuned_igbo\n",
            "For language <lg> NLU provides the following Models : \n",
            "nlu.load('lg.embed_sentence.xlm_roberta') returns Spark NLP model_anno_obj sent_xlm_roberta_base_finetuned_luganda\n",
            "For language <nl> NLU provides the following Models : \n",
            "nlu.load('nl.embed_sentence.bert.base_cased') returns Spark NLP model_anno_obj sent_bert_base_cased\n",
            "For language <pcm> NLU provides the following Models : \n",
            "nlu.load('pcm.embed_sentence.xlm_roberta') returns Spark NLP model_anno_obj sent_xlm_roberta_base_finetuned_naija\n",
            "For language <pt> NLU provides the following Models : \n",
            "nlu.load('pt.embed_sentence.bert.base_legal') returns Spark NLP model_anno_obj sbert_legal_bertimbau_base_tsdae_sts\n",
            "nlu.load('pt.embed_sentence.bert.cased_large_legal') returns Spark NLP model_anno_obj sbert_bert_large_portuguese_cased_legal_mlm_sts_v0.1\n",
            "nlu.load('pt.embed_sentence.bert.large_legal') returns Spark NLP model_anno_obj sbert_legal_bertimbau_large_gpl_sts\n",
            "nlu.load('pt.embed_sentence.bert.legal.cased_large_mlm_sts_v0.10.by_stjiris') returns Spark NLP model_anno_obj sbert_bert_large_portuguese_cased_legal_mlm_sts_v0.10\n",
            "nlu.load('pt.embed_sentence.bert.legal.cased_large_mlm_sts_v0.2.by_stjiris') returns Spark NLP model_anno_obj sbert_bert_large_portuguese_cased_legal_mlm_sts_v0.2\n",
            "nlu.load('pt.embed_sentence.bert.legal.cased_large_mlm_sts_v0.3.by_stjiris') returns Spark NLP model_anno_obj sbert_bert_large_portuguese_cased_legal_mlm_sts_v0.3\n",
            "nlu.load('pt.embed_sentence.bert.legal.cased_large_mlm_sts_v0.4.by_stjiris') returns Spark NLP model_anno_obj sbert_bert_large_portuguese_cased_legal_mlm_sts_v0.4\n",
            "nlu.load('pt.embed_sentence.bert.legal.cased_large_mlm_sts_v0.5.by_stjiris') returns Spark NLP model_anno_obj sbert_bert_large_portuguese_cased_legal_mlm_sts_v0.5\n",
            "nlu.load('pt.embed_sentence.bert.legal.cased_large_mlm_sts_v0.7.by_stjiris') returns Spark NLP model_anno_obj sbert_bert_large_portuguese_cased_legal_mlm_sts_v0.7\n",
            "nlu.load('pt.embed_sentence.bert.legal.cased_large_mlm_sts_v0.8.by_stjiris') returns Spark NLP model_anno_obj sbert_bert_large_portuguese_cased_legal_mlm_sts_v0.8\n",
            "nlu.load('pt.embed_sentence.bert.legal.cased_large_mlm_sts_v0.9.by_stjiris') returns Spark NLP model_anno_obj sbert_bert_large_portuguese_cased_legal_mlm_sts_v0.9\n",
            "nlu.load('pt.embed_sentence.bert.legal.cased_large_mlm_sts_v1.0.by_stjiris') returns Spark NLP model_anno_obj sbert_bert_large_portuguese_cased_legal_mlm_sts_v1.0\n",
            "nlu.load('pt.embed_sentence.bert.legal.cased_large_mlm_v0.11_gpl_nli_sts_v0.by_stjiris') returns Spark NLP model_anno_obj sbert_bert_large_portuguese_cased_legal_mlm_v0.11_gpl_nli_sts_v0\n",
            "nlu.load('pt.embed_sentence.bert.legal.cased_large_mlm_v0.11_gpl_nli_sts_v1.by_stjiris') returns Spark NLP model_anno_obj sbert_bert_large_portuguese_cased_legal_mlm_v0.11_gpl_nli_sts_v1\n",
            "nlu.load('pt.embed_sentence.bert.legal.cased_large_mlm_v0.11_nli_sts_v0.by_stjiris') returns Spark NLP model_anno_obj sbert_bert_large_portuguese_cased_legal_mlm_v0.11_nli_sts_v0\n",
            "nlu.load('pt.embed_sentence.bert.legal.cased_large_mlm_v0.11_nli_sts_v1.by_stjiris') returns Spark NLP model_anno_obj sbert_bert_large_portuguese_cased_legal_mlm_v0.11_nli_sts_v1\n",
            "nlu.load('pt.embed_sentence.bert.legal.cased_large_mlm_v0.11_sts_v0.by_stjiris') returns Spark NLP model_anno_obj sbert_bert_large_portuguese_cased_legal_mlm_v0.11_sts_v0\n",
            "nlu.load('pt.embed_sentence.bert.legal.cased_large_mlm_v0.11_sts_v1.by_stjiris') returns Spark NLP model_anno_obj sbert_bert_large_portuguese_cased_legal_mlm_v0.11_sts_v1\n",
            "nlu.load('pt.embed_sentence.bert.v2_base_legal') returns Spark NLP model_anno_obj sbert_legal_bertimbau_sts_base_ma_v2\n",
            "nlu.load('pt.embed_sentence.bert.v2_large_legal') returns Spark NLP model_anno_obj sbert_legal_bertimbau_large_tsdae_sts_v2\n",
            "nlu.load('pt.embed_sentence.bertimbau.legal.assin.base.by_rufimelo') returns Spark NLP model_anno_obj sbert_legal_bertimbau_sts_base_ma\n",
            "nlu.load('pt.embed_sentence.bertimbau.legal.assin2.base.by_rufimelo') returns Spark NLP model_anno_obj sbert_legal_bertimbau_sts_base\n",
            "nlu.load('pt.embed_sentence.bertimbau.legal.large_sts_by_rufimelo') returns Spark NLP model_anno_obj sbert_legal_bertimbau_sts_large\n",
            "nlu.load('pt.embed_sentence.bertimbau.legal.large_sts_ma.by_rufimelo') returns Spark NLP model_anno_obj sbert_legal_bertimbau_sts_large_ma\n",
            "nlu.load('pt.embed_sentence.bertimbau.legal.large_sts_ma_v3.by_rufimelo') returns Spark NLP model_anno_obj sbert_legal_bertimbau_sts_large_ma_v3\n",
            "nlu.load('pt.embed_sentence.bertimbau.legal.large_tsdae_sts.by_rufimelo') returns Spark NLP model_anno_obj sbert_legal_bertimbau_large_tsdae_sts\n",
            "nlu.load('pt.embed_sentence.bertimbau.legal.large_tsdae_sts_v4.by_rufimelo') returns Spark NLP model_anno_obj sbert_legal_bertimbau_large_tsdae_sts_v4\n",
            "nlu.load('pt.embed_sentence.bertimbau.legal.large_tsdae_v4_gpl_sts.by_rufimelo') returns Spark NLP model_anno_obj sbert_legal_bertimbau_large_tsdae_v4_gpl_sts\n",
            "nlu.load('pt.embed_sentence.bertimbau.legal.v2_large_sts_v2.by_rufimelo') returns Spark NLP model_anno_obj sbert_legal_bertimbau_sts_large_v2\n",
            "nlu.load('pt.embed_sentence.bertimbau.legal.v2_large_v2_sts.by_rufimelo') returns Spark NLP model_anno_obj sbert_legal_bertimbau_large_v2_sts\n",
            "For language <rw> NLU provides the following Models : \n",
            "nlu.load('rw.embed_sentence.xlm_roberta') returns Spark NLP model_anno_obj sent_xlm_roberta_base_finetuned_kinyarwanda\n",
            "For language <sv> NLU provides the following Models : \n",
            "nlu.load('sv.embed_sentence.bert.base_cased') returns Spark NLP model_anno_obj sent_bert_base_cased\n",
            "For language <sw> NLU provides the following Models : \n",
            "nlu.load('sw.embed_sentence.xlm_roberta') returns Spark NLP model_anno_obj sent_xlm_roberta_base_finetuned_swahili\n",
            "For language <wo> NLU provides the following Models : \n",
            "nlu.load('wo.embed_sentence.xlm_roberta') returns Spark NLP model_anno_obj sent_xlm_roberta_base_finetuned_wolof\n",
            "For language <xx> NLU provides the following Models : \n",
            "nlu.load('xx.embed_sentence') returns Spark NLP model_anno_obj sent_bert_multi_cased\n",
            "nlu.load('xx.embed_sentence.bert') returns Spark NLP model_anno_obj sent_bert_multi_cased\n",
            "nlu.load('xx.embed_sentence.bert.cased') returns Spark NLP model_anno_obj sent_bert_multi_cased\n",
            "nlu.load('xx.embed_sentence.bert.muril') returns Spark NLP model_anno_obj sent_bert_muril\n",
            "nlu.load('xx.embed_sentence.bert_use_cmlm_multi_base') returns Spark NLP model_anno_obj sent_bert_use_cmlm_multi_base\n",
            "nlu.load('xx.embed_sentence.bert_use_cmlm_multi_base_br') returns Spark NLP model_anno_obj sent_bert_use_cmlm_multi_base_br\n",
            "nlu.load('xx.embed_sentence.labse') returns Spark NLP model_anno_obj labse\n",
            "nlu.load('xx.embed_sentence.xlm_roberta.base') returns Spark NLP model_anno_obj sent_xlm_roberta_base\n",
            "For language <yo> NLU provides the following Models : \n",
            "nlu.load('yo.embed_sentence.xlm_roberta') returns Spark NLP model_anno_obj sent_xlm_roberta_base_finetuned_yoruba\n",
            "For language <zh> NLU provides the following Models : \n",
            "nlu.load('zh.embed_sentence.bert') returns Spark NLP model_anno_obj sbert_chinese_qmc_finance_v1\n",
            "nlu.load('zh.embed_sentence.bert.distilled') returns Spark NLP model_anno_obj sbert_chinese_qmc_finance_v1_distill\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "IKK_Ii_gjJfF",
        "outputId": "45dea83e-2a0c-4d09-a723-f877ea7527dd"
      },
      "source": [
        "trainable_pipe = nlp.load('en.embed_sentence.small_bert_L12_768 train.sentiment')\n",
        "# We need to train longer and user smaller LR for NON-USE based sentence embeddings usually\n",
        "# We could tune the hyperparameters further with hyperparameter tuning methods like gridsearch\n",
        "# Also longer training gives more accuracy\n",
        "trainable_pipe['trainable_sentiment_dl'].setMaxEpochs(120)\n",
        "trainable_pipe['trainable_sentiment_dl'].setLr(0.0005)\n",
        "fitted_pipe = trainable_pipe.fit(train_df[:500])\n",
        "# predict with the trainable pipeline on dataset and get predictions\n",
        "preds = fitted_pipe.predict(train_df[:500],output_level='document')\n",
        "\n",
        "#sentence detector that is part of the pipe generates some NaNs. lets drop them first\n",
        "preds.dropna(inplace=True)\n",
        "print(classification_report(preds['y'], preds['sentiment']))\n",
        "\n",
        "#preds"
      ],
      "execution_count": 4,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Warning::Spark Session already created, some configs may not take.\n",
            "Warning::Spark Session already created, some configs may not take.\n",
            "sent_small_bert_L12_768 download started this may take some time.\n",
            "Approximate size to download 392.9 MB\n",
            "[OK!]\n",
            "              precision    recall  f1-score   support\n",
            "\n",
            "    negative       0.84      0.56      0.67       229\n",
            "     neutral       0.00      0.00      0.00         0\n",
            "    positive       0.86      0.71      0.78       271\n",
            "\n",
            "    accuracy                           0.64       500\n",
            "   macro avg       0.57      0.42      0.48       500\n",
            "weighted avg       0.85      0.64      0.73       500\n",
            "\n"
          ]
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "_1jxw3GnVGlI"
      },
      "source": [
        "# 7.1 evaluate on Test Data"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "Fxx4yNkNVGFl",
        "outputId": "0f64b81d-884b-46b8-d571-6e32cc0e1a64"
      },
      "source": [
        "preds = fitted_pipe.predict(test_df[:100],output_level='document')\n",
        "\n",
        "#sentence detector that is part of the pipe generates sone NaNs. lets drop them first\n",
        "preds.dropna(inplace=True)\n",
        "print(classification_report(preds['y'], preds['sentiment']))"
      ],
      "execution_count": 5,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "              precision    recall  f1-score   support\n",
            "\n",
            "    negative       0.68      0.35      0.47        48\n",
            "     neutral       0.00      0.00      0.00         0\n",
            "    positive       0.77      0.63      0.69        52\n",
            "\n",
            "    accuracy                           0.50       100\n",
            "   macro avg       0.48      0.33      0.39       100\n",
            "weighted avg       0.73      0.50      0.58       100\n",
            "\n"
          ]
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "2BB-NwZUoHSe"
      },
      "source": [
        "# 8. Lets save the model"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "eLex095goHwm"
      },
      "source": [
        "stored_model_path = './models/classifier_dl_trained'\n",
        "fitted_pipe.save(stored_model_path)"
      ],
      "execution_count": 6,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "e_b2DPd4rCiU"
      },
      "source": [
        "# 9. Lets load the model from HDD.\n",
        "This makes Offlien NLU usage possible!   \n",
        "You need to call nlu.load(path=path_to_the_pipe) to load a model/pipeline from disk."
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 133
        },
        "id": "SO4uz45MoRgp",
        "outputId": "12ba7df2-7ee4-432a-c5bd-52014e1b26ea"
      },
      "source": [
        "hdd_pipe = nlp.load(path=stored_model_path)\n",
        "\n",
        "preds = hdd_pipe.predict('Everything is under control !')\n",
        "preds"
      ],
      "execution_count": 7,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Warning::Spark Session already created, some configs may not take.\n",
            "Warning::Spark Session already created, some configs may not take.\n",
            "Warning::Spark Session already created, some configs may not take.\n"
          ]
        },
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "                        document  \\\n",
              "0  Everything is under control !   \n",
              "\n",
              "                        sentence_embedding_from_disk sentiment  \\\n",
              "0  [0.37780365347862244, 0.29955413937568665, 0.1...  negative   \n",
              "\n",
              "  sentiment_confidence  \n",
              "0                  0.0  "
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-4a463e15-28c7-49b5-8272-ddf0b6d2d6ff\" class=\"colab-df-container\">\n",
              "    <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>document</th>\n",
              "      <th>sentence_embedding_from_disk</th>\n",
              "      <th>sentiment</th>\n",
              "      <th>sentiment_confidence</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>Everything is under control !</td>\n",
              "      <td>[0.37780365347862244, 0.29955413937568665, 0.1...</td>\n",
              "      <td>negative</td>\n",
              "      <td>0.0</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>\n",
              "    <div class=\"colab-df-buttons\">\n",
              "\n",
              "  <div class=\"colab-df-container\">\n",
              "    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-4a463e15-28c7-49b5-8272-ddf0b6d2d6ff')\"\n",
              "            title=\"Convert this dataframe to an interactive table.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
              "    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
              "  </svg>\n",
              "    </button>\n",
              "\n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    .colab-df-buttons div {\n",
              "      margin-bottom: 4px;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "    <script>\n",
              "      const buttonEl =\n",
              "        document.querySelector('#df-4a463e15-28c7-49b5-8272-ddf0b6d2d6ff button.colab-df-convert');\n",
              "      buttonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "      async function convertToInteractive(key) {\n",
              "        const element = document.querySelector('#df-4a463e15-28c7-49b5-8272-ddf0b6d2d6ff');\n",
              "        const dataTable =\n",
              "          await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                    [key], {});\n",
              "        if (!dataTable) return;\n",
              "\n",
              "        const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "          + ' to learn more about interactive tables.';\n",
              "        element.innerHTML = '';\n",
              "        dataTable['output_type'] = 'display_data';\n",
              "        await google.colab.output.renderOutput(dataTable, element);\n",
              "        const docLink = document.createElement('div');\n",
              "        docLink.innerHTML = docLinkHtml;\n",
              "        element.appendChild(docLink);\n",
              "      }\n",
              "    </script>\n",
              "  </div>\n",
              "\n",
              "    </div>\n",
              "  </div>\n"
            ]
          },
          "metadata": {},
          "execution_count": 7
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "e0CVlkk9v6Qi",
        "outputId": "3faff34f-7934-4ea7-f0ee-dc6fcf274b15"
      },
      "source": [
        "hdd_pipe.print_info()"
      ],
      "execution_count": 8,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "The following parameters are configurable for this NLU pipeline (You can copy paste the examples) :\n",
            ">>> component_list['document_assembler'] has settable params:\n",
            "component_list['document_assembler'].setCleanupMode('shrink')                                    | Info: possible values: disabled, inplace, inplace_full, shrink, shrink_full, each, each_full, delete_full | Currently set to : shrink\n",
            ">>> component_list['bert_sentence_embeddings@sent_small_bert_L12_768'] has settable params:\n",
            "component_list['bert_sentence_embeddings@sent_small_bert_L12_768'].setBatchSize(8)               | Info: Size of every batch | Currently set to : 8\n",
            "component_list['bert_sentence_embeddings@sent_small_bert_L12_768'].setCaseSensitive(False)       | Info: whether to ignore case in tokens for embeddings matching | Currently set to : False\n",
            "component_list['bert_sentence_embeddings@sent_small_bert_L12_768'].setDimension(768)             | Info: Number of embedding dimensions | Currently set to : 768\n",
            "component_list['bert_sentence_embeddings@sent_small_bert_L12_768'].setMaxSentenceLength(128)     | Info: Max sentence length to process | Currently set to : 128\n",
            "component_list['bert_sentence_embeddings@sent_small_bert_L12_768'].setEngine('tensorflow')       | Info: Deep Learning engine used for this model | Currently set to : tensorflow\n",
            "component_list['bert_sentence_embeddings@sent_small_bert_L12_768'].setIsLong(False)              | Info: Use Long type instead of Int type for inputs buffer - Some Bert models require Long instead of Int. | Currently set to : False\n",
            "component_list['bert_sentence_embeddings@sent_small_bert_L12_768'].setStorageRef('sent_small_bert_L12_768')  | Info: unique reference name for identification | Currently set to : sent_small_bert_L12_768\n",
            ">>> component_list['sentiment_dl@sent_small_bert_L12_768'] has settable params:\n",
            "component_list['sentiment_dl@sent_small_bert_L12_768'].setThreshold(0.6)                         | Info: The minimum threshold for the final result otheriwse it will be neutral | Currently set to : 0.6\n",
            "component_list['sentiment_dl@sent_small_bert_L12_768'].setThresholdLabel('neutral')              | Info: In case the score is less than threshold, what should be the label. Default is neutral. | Currently set to : neutral\n",
            "component_list['sentiment_dl@sent_small_bert_L12_768'].setEngine('tensorflow')                   | Info: Deep Learning engine used for this model | Currently set to : tensorflow\n",
            "component_list['sentiment_dl@sent_small_bert_L12_768'].setClasses(['positive', 'negative'])      | Info: get the tags used to trained this SentimentDLModel | Currently set to : ['positive', 'negative']\n",
            "component_list['sentiment_dl@sent_small_bert_L12_768'].setStorageRef('sent_small_bert_L12_768')  | Info: unique reference name for identification | Currently set to : sent_small_bert_L12_768\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "-S888rwObpEs"
      },
      "source": [],
      "execution_count": null,
      "outputs": []
    }
  ]
}